R-Studio.安装lubridate后出现错误:找不到函数"dmy_hm" [英] R-Studio. Error after installing lubridate: could not find function "dmy_hm"

查看:369
本文介绍了R-Studio.安装lubridate后出现错误:找不到函数"dmy_hm"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先我安装了lubridate:

First I installed lubridate:

install.packages("lubridate") Installing package into ‘C:/Users/Llorenc  Piera/AppData/Roaming/SPB_Data/R/win-library/3.4’ (as ‘lib’ is unspecified) trying URL  'https://cran.rstudio.com/bin/windows/contrib/3.4/lubridate_1.7.4.zip' Content type 'application/zip' length 1365606 bytes (1.3 MB) downloaded 1.3 MB

package ‘lubridate’ successfully unpacked and MD5 sums checked

install.packages中的警告:无法删除以前安装的 打包"lubridate"

Warning in install.packages : cannot remove prior installation of package ‘lubridate’

然后我尝试运行:

dmy_hm('01-01-2012 12:12')

并获得:

dmy_hm("2012年1月1日12:12")错误:找不到函数"dmy_hm"

Error in dmy_hm("01-01-2012 12:12") : could not find function "dmy_hm"

这在几周前可以在我的计算机上工作,但现在不再可用.

This used to work in my computer a few weeks ago, but not any more.

但是,如果我跑步:

lubridate::dmy_hm('01-01-2012 12:12')

我知道

[1] "2012-01-01 12:12:00 UTC"

但是使用'lubridate ::'对我不好,因为它无法在其他函数中使用

But using 'lubridate::' is not good for me since it does not work inside other functions

推荐答案

The

lubridate::dmy_hm('01-01-2012 12:12') 

表示: 运行lubridate包中的dmy_hm函数. 但您需要拥有library(lubridate)

means: run the dmy_hm function from lubridate package. but you need to have the library(lubridate)

如果您使用的是Rstudio,请按照以下步骤操作:

if you are using Rstudio, then follow these steps:

使用更简单的选项来安装软件包.如Packages -> Intall -> name of package

Use easier options to install a package. Such as Packages -> Intall -> name of package

然后在package选项卡中,搜索lubridate并确保已选中它.

Then in the package tab, and search for the lubridate and make sure it is checked.

下图显示了操作方法.

这篇关于R-Studio.安装lubridate后出现错误:找不到函数"dmy_hm"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆