R cannot load package forecast due to namespace error - r

I tried installing all the dependant packages and also tried another repo source as recommended in another post here.
R version 3.2.0 x64
install.packages("fracdiff")
install.packages("Rcpp")
install.packages("RcppArmadillo")
install.packages("colorspace")
install.packages("forecast", dep=T)
install.packages("forecast", repos=c("http://cran.rstudio.com"),dep=T)
library("forecast")
then I get
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
Loading required package: timeDate
Error : .onAttach failed in attachNamespace() for 'forecast', details:
call: fun(libname, pkgname)
error: 4 arguments passed to .Internal(nchar) which requires 3
In addition: Warning message:
package ‘forecast’ was built under R version 3.2.1
Error: package or namespace load failed for ‘forecast’
sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] Hmisc_3.16-0 ggplot2_1.0.1 Formula_1.2-1 survival_2.38-1 lattice_0.20-31 zoo_1.7-12 timeSeries_3012.99 timeDate_3012.100
loaded via a namespace (and not attached):
[1] Rcpp_0.11.6 cluster_2.0.1 magrittr_1.5 MASS_7.3-41 splines_3.2.0 forecast_6.1 munsell_0.4.2
[8] colorspace_1.2-6 quadprog_1.5-5 stringr_1.0.0 plyr_1.8.3 tools_3.2.0 nnet_7.3-9 parallel_3.2.0
[15] gtable_0.1.2 latticeExtra_0.6-26 tseries_0.10-34 digest_0.6.8 gridExtra_0.9.1 RColorBrewer_1.1-2 reshape2_1.4.1
[22] acepack_1.3-3.3 rpart_4.1-9 fracdiff_1.4-2 stringi_0.4-1 scales_0.2.5 foreign_0.8-63 proto_0.3-10

I tried to reproduce. I get no message about either loading timeDate or the error you see. I do get a message about loading pkg:zoo. The package loads and announces its version number. Try updating to R version 3.2.1, since that is where a new argument to nchar was introduced:
new$Text[ grep("nchar", news$Text) ]
• nchar(x, *) and nzchar(x) gain a new argument keepNA which governs how the result for NAs in x is determined. For the R 3.2.x series, the default remains FALSE which is fully back compatible. From R 3.3.0, the default will change to keepNA = NA and you are advised to consider this for code portability.

Related

Error devtools::check - .onLoad failed in loadNamespace() for 'pillar'

Im building an R package and when testing the package using devtools::check() I get an error when the test reaches the installation phase, saying:
Error: .onLoad failed in loadNamespace() for 'pillar', details:
call: utils::packageVersion("vctrs")
error: there is no package called 'vctrs'
Execution halted
ERROR: lazy loading failed for package
Neither pillar nor vctrs are mentioned in my description file, so they must be dependents of some other package that I depend on. Both pillar and vctrs are installed and I've also tried reinstalling them. They are stored in the the first .libPath entry. I tried installing pillar from github as was suggested by mfox9 here, but this failed for me, giving this error:
> devtools::install_github("r-lib/pillar")
Downloading GitHub repo r-lib/pillar#master
√ checking for file 'C:\Users\DESCRIPTION' (337ms)
- preparing 'pillar': (664ms)
√ checking DESCRIPTION meta-information ...
- installing the package to process help pages
- checking for LF line-endings in source and make files and shell scripts (8.5s)
- checking for empty or unneeded directories
- building 'pillar_1.4.2.9001.tar.gz'
Installing package into ‘Z:/’
(as ‘lib’ is unspecified)
The filename, directory name, or volume label syntax is incorrect.
Error: Failed to install 'pillar' from GitHub:
(converted from warning) installation of package ‘C:/Users/Temp/RtmpgjFfZl/file32586b634e28/pillar_1.4.2.9001.tar.gz’ had non-zero exit status
(note: z:/ is my correct R library address)
Can someone please help?
´´´
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 15063)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] pillar_1.4.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 rstudioapi_0.10 magrittr_1.5 usethis_1.5.1
[5] devtools_2.2.0 pkgload_1.0.2 R6_2.4.0 rlang_0.4.0
[9] tools_3.6.1 pkgbuild_1.0.5 DT_0.8 packrat_0.5.0
[13] sessioninfo_1.1.1 cli_1.1.0 withr_2.1.2 remotes_2.1.0
[17] htmltools_0.3.6 ellipsis_0.2.0.1 assertthat_0.2.1 digest_0.6.20
[21] rprojroot_1.3-2 crayon_1.3.4 processx_3.4.1 callr_3.3.1
[25] fs_1.3.1 htmlwidgets_1.3 ps_1.3.0 curl_4.0
[29] testthat_2.2.1 glue_1.3.1 memoise_1.1.0 compiler_3.6.1
[33] desc_1.2.0 backports_1.1.4 prettyunits_1.0.2
´´´

Error while trying to use 'ez' library

I've error while trying to call ez library for rAnova, the issue that I cannot found pbkrtest package while I executed with success install.packages("ez"). library(ez) return to me the following error :
Error in loadNamespace (j <- i [[1L]], c (lib.loc, .libPaths ()) = vI VERSIONCHECK [[j]]): no package named 'pbkrtest' is found
In addition: Warning message: package 'ez' was compiled with version 3.2.5 R Error: loading the package or namespace failed for 'ez'
How can I properly use this library ? Thanks
EDIT : Sessioninfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_1.12.0
loaded via a namespace (and not attached):
Error in x[["Version"]] : index out of limits
De plus : Warning messages:
1: In FUN(X[[i]], ...) :
The file DESCRIPTION of the package 'digest' is missing or incorrect
2: In FUN(X[[i]], ...) :
The file DESCRIPTION of the package 'nlme' is missing or incorrect
EDIT 2: Sessioninfo() after restarting machine and R
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] MASS_7.3-45 Matrix_1.2-7.1 tools_3.2.2 mgcv_1.8-15
[5] nnet_7.3-12 nlme_3.1-121 grid_3.2.2 lattice_0.20-34
but still the same error (above) when tape library(ez).
So it seems that was a question of R version. As noticed in the error and as I understood 'ez' was compiled with version 3.2.5 R. So now i'm under 3.3.1 and I intalled EZ with success and can load the library and use the function. The more complicated is to reinstall R and all packages that seems painful, but thanks to this great post that allow me to store all my packages in a temp folder and to reinstall them in the newest version
For information if it could help someone else, my Sessioninfo() returns :
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ez_4.3
loaded via a namespace (and not attached):
[1] Rcpp_0.12.7 magrittr_1.5 splines_3.3.1 MASS_7.3-45 munsell_0.4.3
[6] colorspace_1.2-6 lattice_0.20-33 minqa_1.2.4 stringr_1.1.0 car_2.1-3
[11] plyr_1.8.4 tools_3.3.1 nnet_7.3-12 parallel_3.3.1 pbkrtest_0.4-6
[16] grid_3.3.1 nlme_3.1-128 gtable_0.2.0 mgcv_1.8-12 quantreg_5.29
[21] MatrixModels_0.4-1 lme4_1.1-12 Matrix_1.2-6 nloptr_1.0.4 reshape2_1.4.1
[26] ggplot2_2.1.0 stringi_1.1.2 scales_0.4.0 SparseM_1.72
>

Install.packages("ggplot2") installing older version (1.0.0)

So I installed an old version of ggplot2 with install_version from devtools (0.9.1 or something) to see how it worked - over the previously installed 2.0.0 version by the way. I then upgraded the version and it surprisingly gave me version 1.0.0, not the current 2.0.0.
Now when I do an install.packages("ggplot2") I get the same 1.0.0. Also selecting "Check for package upgrades.." item from the Rstudio menu it tells me "All packages up to date".
What gives? Isn't the newest version of ggplot now 2.0.0? Here is my session info:
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_1.9.1 ggplot2_1.0.0 dplyr_0.4.3 shiny_0.12.2 RevoUtils_7.5.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.2 magrittr_1.5 MASS_7.3-43 munsell_0.4.2 colorspace_1.2-6
[6] xtable_1.8-0 R6_2.1.1 stringr_1.0.0 plyr_1.8.3 tools_3.2.2
[11] parallel_3.2.2 grid_3.2.2 gtable_0.1.2 DBI_0.3.1 htmltools_0.2.6
[16] assertthat_0.1 digest_0.6.8 reshape2_1.4.1 memoise_0.2.1 mime_0.4
[21] stringi_1.0-1 scales_0.3.0 jsonlite_0.9.19 httpuv_1.3.3 proto_0.3-10
>
Here are the repositories it is seeing:
> AP <- available.packages()
> apdf <- data.frame(AP)
> unique(apdf$Repository)
[1] http://mran.revolutionanalytics.com/snapshot/2014-12-01/src/contrib
[2] http://www.stats.ox.ac.uk/pub/RWin/src/contrib
2 Levels: http://mran.revolutionanalytics.com/snapshot/2014-12-01/src/contrib ...
>
Update:
Thanks to Dirk, I see what happened. Looks like installing RRO package reset my CRAN repository. I can also sort of see why that had to be, although maybe I should have got a warning about it. From this blog entry I see how to fix it too. http://www.r-bloggers.com/permanently-setting-the-cran-repository/
Run
AP <- available.packages() # possibly with repo options
and examine the result set.
That is what your R session knows about packages, and it is a function of
the R version; you generally want the newest series (and you have 3.2.*)
the repos you select (which you did not show)
Edit: I typically use options("repos") to check which repositories I have, and I tend to control that from Rprofile.site. But you seem to have RevoR and I do not know how/if that interacts.

Can not install shinyTable successfully

I followed the instruction on the Github. It returned me an error like this:
install_github("shinyTable", "trestletech")
Downloading github repo trestletech/shinyTable#master
Error in curl::curl_fetch_memory(url, handle = handle) :
Timeout was reached
In addition: Warning message:
Username parameter is deprecated. Please use trestletech/shinyTable
Then, I tried to download the repo zip file and installed the shinyTable from local zip file in R studio. After that, I library(shinyTable). It return me an error.
> install.packages("D:/UserData/xxxx/Downloads/shinyTable-master.zip", repos = NULL)
Installing package into ‘D:/UserData/xxxx/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
> library(shinyTable)
Error in library(shinyTable) : there is no package called ‘shinyTable’
This is sessionInfo() result:
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shinyRGL_0.1.0 devtools_1.8.0 rJava_0.9-7
loaded via a namespace (and not attached):
[1] rgl_0.95.1247 Rcpp_0.12.0 digest_0.6.8 mime_0.3 R6_2.1.0 xtable_1.7-4 git2r_0.10.1
[8] magrittr_1.5 httr_1.0.0 stringi_0.5-5 curl_0.9.2 xml2_0.1.1 tools_3.2.1 stringr_1.0.0
[15] shiny_0.12.2 httpuv_1.3.3 rversions_1.0.2 htmltools_0.2.6 tcltk_3.2.1 memoise_0.2.1
Does anyone know the reason and tell me how to install it? Thank you.
I had similar issues recently. Can you try this:
library(devtools)
install_git("https://github.com/trestletech/shinyTable")

Lazyeval over-writing dplyr?

Not quite understanding what "lazyeval" is, I was trying to install and run the package to use dplyr within a function.
When I ran
library(lazyeval)
I got the error message:
Error in library(lazyeval) : there is no package called 'lazyeval'
even after successfully installing.
Now, though, when I try to run any standard dplyr script, I get the following error message:
Error in loadNamespace(name) : there is no package called 'lazyeval'
It's as if the lazyeval has over-written dplyr, but I can't actually use lazyeval.
Has anyone run into this issue? If so, how did you resolve?
Some info:
sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] grid splines stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] scales_0.2.4 gridExtra_0.9.1 ggplot2_1.0.0 forecast_5.4
[5] timeDate_3010.98 reshape2_1.4 xts_0.9-7 zoo_1.7-11
[9] lubridate_1.3.3 dplyr_0.4.1 plyr_1.8.1
loaded via a namespace (and not attached):
[1] assertthat_0.1 colorspace_1.2-4 DBI_0.3.1 digest_0.6.4
[5] fracdiff_1.4-2 gtable_0.1.2 lattice_0.20-29 magrittr_1.0.1
[9] MASS_7.3-35 memoise_0.2.1 munsell_0.4.2 nnet_7.3-8
[13] parallel_3.1.2 proto_0.3-10 quadprog_1.5-5 Rcpp_0.11.1
[17] stringr_0.6.2 tools_3.1.2 tseries_0.10-32
When I run .libPaths(), I get two directories:
[1] "C:/Users/MTULLA/Documents/R/win-library/3.1"
[2] "C:/Program Files/R/R-3.1.2/library"
In the first, I can find both dplyr and lazyeval, both with .dll files. In the second, I can't find either
I also got this message when running the lesson 1 of Getting and Cleaning Data on Swirl.
Package ‘dplyr’ loaded correctly!
Error in loadNamespace(name) : there is no package called ‘lazyeval’
Reinstalling packages also didn't work
It was solved by updating my R version using the {installr} package
It can be resolved by installing the package with all the dependencies, using:
install.packages("dplyr", dependencies = TRUE)
It will install others like lazyeval, knitr etc. Worked for me to solve the
Error in loadNamespace(name): there is no package called ‘lazyeval’ issue.

Resources