R 需要一个包 (hms) 来导入数据集。我安装包没有任何反应。如何正确安装它?
R requires a package (hms) to import a dataset. I install the package nothing happens. How do I install it properly?
更新:下面的评论者提供了很大帮助并准确描述了解决方案。
我是一名硕士生,正在尝试将存储在 .dta 文件中的数据导入我桌面上的文件夹中。
在我的 R Studio 环境中,我点击了一个按钮“导入数据集”(我在过去多次成功使用过),它给了我一个错误:“没有名为 hms 的包”。
此处出现错误信息:https://i.imgur.com/XZIAfs3.png
我进入“包”查看器并点击“安装”以安装包 hms 而不更改默认值。您可以在此处查看 window:https://i.imgur.com/o6p2RCW.png
更新:手动安装生命周期、hms 和 rlang 包后,这就是我尝试从 stata 导入数据集时屏幕的样子。我现在的假设是我当前的错误与我尝试安装的包无关。我想我已经清除了这个障碍:https://i.imgur.com/MDvtCYK.png
下面的标记是我在安装 hms 时得到的准确输出。
Installing package into ‘C:/Users/nfeld/OneDrive/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependency ‘lifecycle’
There are binary versions available but the source versions are later:
binary source needs_compilation
lifecycle 0.2.0 1.0.0 FALSE
hms 0.5.3 1.0.0 FALSE
installing the source packages ‘lifecycle’, ‘hms’
trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_1.0.0.tar.gz'
Content type 'application/x-gzip' length 83389 bytes (81 KB)
downloaded 81 KB
trying URL 'https://cran.rstudio.com/src/contrib/hms_1.0.0.tar.gz'
Content type 'application/x-gzip' length 42765 bytes (41 KB)
downloaded 41 KB
* installing *source* package 'lifecycle' ...
** package 'lifecycle' successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Error in rbind(info, getNamespaceInfo(env, "S3methods")) :
number of columns of matrices must match (see arg 2)
ERROR: lazy loading failed for package 'lifecycle'
* removing 'C:/Users/nfeld/OneDrive/Documents/R/win-library/3.5/lifecycle'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘lifecycle’ had non-zero exit status
ERROR: dependency 'lifecycle' is not available for package 'hms'
* removing 'C:/Users/nfeld/OneDrive/Documents/R/win-library/3.5/hms'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘hms’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\nfeld\AppData\Local\Temp\RtmpcPhJj5\downloaded_packages’
问题的解决方案是重新安装 R/Rstudio 和所有必需的软件包。我认为这是由包版本不兼容 (https://github.com/tidyverse/tidyverse/issues/179) 的已知问题引起的,并且可能与将 R 包安装到 OneDrive 文件夹有关。
更新:下面的评论者提供了很大帮助并准确描述了解决方案。
我是一名硕士生,正在尝试将存储在 .dta 文件中的数据导入我桌面上的文件夹中。
在我的 R Studio 环境中,我点击了一个按钮“导入数据集”(我在过去多次成功使用过),它给了我一个错误:“没有名为 hms 的包”。
此处出现错误信息:https://i.imgur.com/XZIAfs3.png
我进入“包”查看器并点击“安装”以安装包 hms 而不更改默认值。您可以在此处查看 window:https://i.imgur.com/o6p2RCW.png
更新:手动安装生命周期、hms 和 rlang 包后,这就是我尝试从 stata 导入数据集时屏幕的样子。我现在的假设是我当前的错误与我尝试安装的包无关。我想我已经清除了这个障碍:https://i.imgur.com/MDvtCYK.png
下面的标记是我在安装 hms 时得到的准确输出。
Installing package into ‘C:/Users/nfeld/OneDrive/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependency ‘lifecycle’
There are binary versions available but the source versions are later:
binary source needs_compilation
lifecycle 0.2.0 1.0.0 FALSE
hms 0.5.3 1.0.0 FALSE
installing the source packages ‘lifecycle’, ‘hms’
trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_1.0.0.tar.gz'
Content type 'application/x-gzip' length 83389 bytes (81 KB)
downloaded 81 KB
trying URL 'https://cran.rstudio.com/src/contrib/hms_1.0.0.tar.gz'
Content type 'application/x-gzip' length 42765 bytes (41 KB)
downloaded 41 KB
* installing *source* package 'lifecycle' ...
** package 'lifecycle' successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Error in rbind(info, getNamespaceInfo(env, "S3methods")) :
number of columns of matrices must match (see arg 2)
ERROR: lazy loading failed for package 'lifecycle'
* removing 'C:/Users/nfeld/OneDrive/Documents/R/win-library/3.5/lifecycle'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘lifecycle’ had non-zero exit status
ERROR: dependency 'lifecycle' is not available for package 'hms'
* removing 'C:/Users/nfeld/OneDrive/Documents/R/win-library/3.5/hms'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘hms’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\nfeld\AppData\Local\Temp\RtmpcPhJj5\downloaded_packages’
问题的解决方案是重新安装 R/Rstudio 和所有必需的软件包。我认为这是由包版本不兼容 (https://github.com/tidyverse/tidyverse/issues/179) 的已知问题引起的,并且可能与将 R 包安装到 OneDrive 文件夹有关。