Installing Source Packages - r

I'm unable to install certain source packages in R. Until now I've just made do with using binary, however the in trying to use rmarkdown this workaround isn't possible (RMarkdown requires updated version to work).
I don't understand what this issue is. I've installed the correct version of RTools (3.5) for the R (3.6.3) that I'm using, but that alone hasn't fixed it.
Am using Windows 10.
Would really appreciate pointing in the right direction. The error message looks like this (for all packages that fail):
** Installing R Package Dependencies for R Markdown: 'rmarkdown', 'stringi'
[1/4] Installing bslib...
Installing package into 'C:/Users/paulb/OneDrive/Documents/R/win-library/3.6'
(as 'lib' is unspecified)
also installing the dependency 'htmltools'
There are binary versions available but the source versions are later:
binary source needs_compilation
htmltools 0.5.1.1 0.5.2 TRUE
bslib 0.2.4 0.3.1 FALSE
installing the source packages 'htmltools', 'bslib'
trying URL 'https://cran.rstudio.com/src/contrib/htmltools_0.5.2.tar.gz'
Content type 'application/x-gzip' length 124510 bytes (121 KB)
==================================================
downloaded 121 KB
trying URL 'https://cran.rstudio.com/src/contrib/bslib_0.3.1.tar.gz'
Content type 'application/x-gzip' length 4908277 bytes (4.7 MB)
==================================================
downloaded 4.7 MB
Error: object 'R' not found
Execution halted

First we have to install r version and RStudio then install recommend packages.
Use below youtube link in Hindi.
https://www.youtube.com/watch?v=dgmCiZvdI_4

Related

R version 3.4.1 error in install.packages(ggplot2)

I am having some trouble installing packages on R, and I'm not sure what to do. The errors are as follows:
The downloaded binary packages are in
C:\Users\XanDesktop\AppData\Local\Temp\Rtmpyy8lER\downloaded_packages
install.packages("ggplot2", repos="http://cran.rstudio.com/")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/XanDesktop/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependency ‘rlang’
There are binary versions available but the source versions are later:
binary source needs_compilation
rlang 0.3.4 0.4.11 TRUE
ggplot2 3.1.1 3.3.5 FALSE
Binaries will be installed
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.4/rlang_0.3.4.zip'
Content type 'application/zip' length 1080437 bytes (1.0 MB)
downloaded 1.0 MB
Error in install.packages : cannot open file 'C:/Users/XanDesktop/Documents/R/win-library/3.4/file4c04705ac2/rlang/help/figures/rlang.png': Permission denied
Any ideas? Thanks in advance!

Issue in installing devtools in R version 4.0

After updating the R version from 3.5 to 4.0 I am facing installation issues with devtools package.
Having Rtools 4.0 and RStudio-1.2.5042 downloaded and installed.
when I try to install devtools
install.packages("devtools")
I get this message:
WARNING: Rtools is required to build R packages but is not currently
installed. Please download and install the appropriate version of
Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/ Installing package into
‘C:/Users/shalzsab/Documents/R/win-library/4.0’ (as ‘lib’ is
unspecified) also installing the dependency ‘usethis’
There is a binary version available but the source version is later:
binary source needs_compilation usethis 1.6.0 1.6.1 FALSE
trying URL
'https://cran.rstudio.com/bin/windows/contrib/4.0/devtools_2.3.0.zip'
Content type 'application/zip' length 351089 bytes (342 KB) downloaded
342 KB
package ‘devtools’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\shalzsab\AppData\Local\Temp\RtmpkhJwos\downloaded_packages
installing the source package ‘usethis’
trying URL 'https://cran.rstudio.com/src/contrib/usethis_1.6.1.tar.gz'
Content type 'application/x-gzip' length 255052 bytes (249 KB)
downloaded 249 KB
The downloaded source packages are in
‘C:\Users\shalzsab\AppData\Local\Temp\RtmpkhJwos\downloaded_packages’
And when I load the package I get this error
library(devtools)
Error: package ‘usethis’ required by ‘devtools’ could not be found
If I try to check the packages in the installation directory
find.package("devtools")
"C:/Users/shalzsab/Documents/R/win-library/4.0/devtools"
For usethis package I get this error
find.package("usethis")
Error in find.package("usethis") : there is no package called ‘usethis’
How can I solve this?

Issues installing "forecast" package in R

I am trying to install the forecast package in R via: install.packages('forecast'), nevertheless this is not working.
The result:
There is a binary version available but the source version is later:
binary source needs_compilation
forecast 8.2 8.3 TRUE
Do you want to install from sources the package which needs compilation?
Not sure what to answer here, 'yes' or 'no'. If I answer 'no', the result is:
trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/forecast_8.2.tgz'
Content type 'application/x-gzip' length 2204227 bytes (2.1 MB)
==================================================
downloaded 2.1 MB
tar: Failed to set default locale
The downloaded binary packages are in
/var/folders/qn/syx5z5tj4s5075wwmrrd3hbr0000gn/T//RtmpTBDqVs/downloaded_packages
If I type 'yes' some additional items are installed and I receive one error note:
Warning in install.packages :
installation of package 'forecast' had non-zero exit status
Unfortunately I cannot proceed with the necessary functions that this package provides. Thanks for any suggestions.
I had the same problems, changing primary CRAN repository works for me
Tools > Global Options > Packages

Persistence when running update.packages in R

If I open up an R console and send the command
update.packages(repos = "https://cran.cnr.Berkeley.edu/",ask=FALSE,checkBuilt=TRUE)`
It starts updating a small collection of packages, a somewhat representative output might include
Warning: package 'mgcv' in library 'C:/Program Files/R/R-3.4.2/library' will not be updated
There is a binary version available but the source version is later:
binary source needs_compilation
rlang 0.1.2 0.1.4 TRUE
Binaries will be installed
trying URL 'https://cran.cnr.Berkeley.edu/bin/windows/contrib/3.4/rlang_0.1.2.zip'
Content type 'application/zip' length 466520 bytes (455 KB)
downloaded 455 KB
package 'rlang' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\me\AppData\Local\Temp\RtmpYFaFCR\downloaded_packages
update.packages(repos = "https://cran.cnr.Berkeley.edu/",ask=FALSE,checkBuilt=TRUE)
Warning: package 'mgcv' in library 'C:/Program Files/R/R-3.4.2/library' will not be updated
There is a binary version available but the source version is later:
binary source needs_compilation
rlang 0.1.2 0.1.4 TRUE
Binaries will be installed
trying URL 'https://cran.cnr.Berkeley.edu/bin/windows/contrib/3.4/rlang_0.1.2.zip'
Content type 'application/zip' length 466520 bytes (455 KB)
downloaded 455 KB
package 'rlang' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\me\AppData\Local\Temp\RtmpYFaFCR\downloaded_packages
Unfortunately, if I turn around and run this again, I get the same report. This strikes me as not quite right, as these packages (with the exception of the ones explicitly tagged as "Will not be updated") should have been updated. Why are they still out of date?
The example above is small because I'm starting from a relatively new install, but as the months go by, this list will get longer and longer and it bogs down my script.
Hopefully this will be easily reproducible.

Persistent problems installing the car package in R

I'm having problems installing the package car in R.
There are previous posts on the topic, including this one and this other one.
I have followed the suggestions I've come across so far without success. I am using R Version 3.2.2. and RStudio.
This is the message I get:
install.packages("car")
Installing package into ‘C:/Users/.../Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/car_2.1-3.zip'
Content type 'application/zip' length 1447213 bytes (1.4 MB)
downloaded 1.4 MB
package ‘car’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\...\AppData\Local\Temp\Rtmpc3xr5i\downloaded_packages
If I check I get,
?car
No documentation for ‘car’ in specified packages and libraries:
you could try ‘??car’
I tried installing it from R with Install packages from local zip drives, and looking for the zip in C:\Users\...\AppData\Local\Temp\Rtmpc3xr5i\downloaded_packages, but this is the result:
library(car)
Error in library.dynam(lib, package, package.lib) :
DLL ‘SparseM’ not found: maybe not installed for this architecture?
In addition: Warning message:
package ‘car’ was built under R version 3.2.5
Error: package or namespace load failed for ‘car’
I did try installing SparseM even before posting the OP without success:
> install.packages("SparseM")
Installing package into ‘C:/Users/.../Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/SparseM_1.7.zip'
Content type 'application/zip' length 795531 bytes (776 KB)
downloaded 776 KB
package ‘SparseM’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\...\AppData\Local\Temp\Rtmpc3xr5i\downloaded_packages
> ?SparseM
No documentation for ‘SparseM’ in specified packages and libraries:
you could try ‘??SparseM’
Follow up:
After a comment regarding R version 3.2.3 I thought it would be an easy fix to just download this version, install, and erase 3.2.2. The problem then is that RStudio did not seem to work. I un-installed and re-installed R-studio, and now I get this when opening R studio:
Without knowing what version of the car package you're using, it's hard to know exactly what the source of the problem is. It seems likely, however, that you haven't installed the proper version of the pbkrtest, on which the Rcmdr package depends.
Is there a compelling reason not to upgrade everything to their current versions, including R, all packages, and RStudio?
Best,
John

Resources