简体   繁体   中英

How to deal with: Error: could not find function "read_csv"

I installed the package readr and tried to upload a .csv file in Rstudio. When I try to load this package I get the following error:

> library(readr)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), 
versionCheck   = vI[[j]]) : there is no package called ‘hms’ In addition:
Warning message: Paket ‘readr’ wurde unter R Version 3.2.5 erstellt 
Error: Laden von Paket oder Namensraum für ‘readr’ fehlgeschlagen

When I try to upload the .csv file in RI get the error:

> dataX<-read_csv("file.csv")
 Error: could not find function "read_csv"

The result of sessionInfo() is:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
[5] LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

 loaded via a namespace (and not attached):
 [1] colorspace_1.3-2 scales_0.4.1     R6_2.2.2   lazyeval_0.2.0            plyr_1.8.4      
 [6] tools_3.2.2      gtable_0.2.0     tibble_1.3.0     Rcpp_0.12.10      ggplot2_2.2.1   
 [11] grid_3.2.2       munsell_0.4.3   

I will appreciate your help. Thanks.

Ok, I was able to duplicate the problem on Windows. How and Why?

Resolution - Install R3.4.4

How

Why?

The issue here (appears to be) that readr and the TidyVerse packages require later versions of R than R3.2.2. and the WIndows Rtools you have. I was able to duplicate the issue described by installing R3.2.2 and RTools3.2 and then trying to instal readr.

I did not encounter the error on installation of R3.4.4.

Background on Upgrading R on Windows:

You can install multiple versions of R ( Base environment ) and R Tools ( Development environment) on Windows. My personal recommendation is to uninstall R, install the new versions of R, then install the latest R Tools and copy over the libraries per Windows faq below.

2.8 What's the best way to upgrade?

That's a matter of taste. For most people the best thing to do is to uninstall R (see the previous Q), install the new version, copy any installed packages to the library folder in the new installation, run update.packages(checkBuilt=TRUE, ask=FALSE) in the new R and then delete anything left of the old installation. Different versions of R are quite deliberately installed in parallel folders so you can keep old versions around if you wish.

For those with a personal library (folder R\win-library\xy of your home directory, R\win64-library\xy on 64-bit builds), you will need to update that too when the minor version of R changes (eg from 3.0.2 to 3.1.0). A simple way to do so is to copy (say) R\win-library\3.0 to R\win-library\3.1 before running update.packages(checkBuilt=TRUE, ask=FALSE) .

我也有类似的问题,当我已经使用 3.4.4 版本的 R 时,重新安装包“tidyverse”对我有用。

For me, it was loading tidyverse into the environment that did the trick. Load both tidyverse and dplyr

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM