unable to install R packages - unknown input format - r

I have a work laptop that has recently forced a migration to microsoft OneDrive and all kinds of things have been squirrely since then, so I'll preface that MAYBE that has something to do with it. I'm running R 3.6.3 in RStudio.
Suddenly today though when I try to install a package I get a very weird error message I've never encountered before
install.packages("tidyquant")
warning in install.packages :
unable to access index for repository http://cran.rstudio.com/src/contrib:
Found continuation line starting ' <!DOCTYPE html> ...' at begin of record.
Error in install.packages : unknown input format
I tried some troubleshooting steps found elsewhere including
uncheck the global option for require secure download
delete the .Rhistory file and run update.packages()
when I run update.packages() I get
Error in readRDS(dest) : unknown input format
Any advice on how to proceed would be most appreciated.

Related

RStudio - Not able to install packages after reinstallation of R & constant working directory issues

I recently had to have a new laptop build at work and therefore reinstalled R and R Studio through a designated 'Company Portal' that did the software installation for me (this might be the problem). When now trying to install and load packages for use, I am running in to the below error for packages (in this case for tidyverse):
Warning message: In options(stringsAsFactors = TRUE) :
'options(stringsAsFactors = TRUE)' is deprecated and will be
disabled Error in setwd("C:/R/WorkingDir") : cannot change working
directory Execution halted Warning in install.packages :
installation of package ‘tidyselect’ had non-zero exit status
I also had this error when I first loaded R up that seems to be reappearing due any attempt to install packages:
Error in setwd("C:/R/WorkingDir") :
cannot change working directory
I've never had this issue before using RStudio across numerous machines and software versions, can anyone advise what is going on? My name (and thus C:\ user file path(s)) does have an apostrophe in it, if that matters - but it has never been an issue before. Is some key installation setting now misaligned and if yes, can anyone advise how to resolve?

Why do I get a "failed to lock directory" error when installing packages on my work laptop

I've recently installed R + Rstudio on my work-laptop and now I'm trying to install packages. I have full authorisation in the map that I'm downloading the packages to. However, I keep on getting the following error:
Error in install.packages : ERROR: failed to lock directory
‘\\hltfs001\Home$\jolien.jansen\Documents\R\win-library\3.6’ for
modifying. Try removing
‘\\hltfs001\Home$\jolien.jansen\Documents\R\win-library\3.6/00LOCK’
This error is accompanied by this error:
Warning in install.packages :
'lib = "\\hltfs001/Home$/jolien.jansen/Documents/R/win-library/3.6"'
is not writable
I've tried to install the packages in a different folder, which I'm also authorised to do, but that did not solve the issue.
I've googled the error and that gave me a couple of things to try.
At first I tried manually removing the LOCK folder, and restarting R. That did not help
Then I tried this code:
unlink("/hltfs001/Home$/jolien.jansen/Documents/R/win-
library/3.6/00LOCK", recursive = TRUE)
Which again removed the LOCK folder, but didn't help with the error either
Finally I tried:
install.packages("Rcpp", dependencies=TRUE, INSTALL_opts = c('--no-
lock'))
But again, that gave me the same error.
I had the same problem and I found that my problem is that my 00LOCK folder was located within an automatic-syncing Dropbox folder. So, I paused the Dropbox sync and then the problem went away after I deleted the 00LOCK folder. Apparently, the Dropbox syncing was interfering with the file locking mechanism of the installation process. So, once I finished installing the packages, I resumed my Dropbox syncing.

R Package Error(s)

I'm running into a bunch of errors when trying to install any packages on R 3.4.4 on Windows 7. Originally, installed.packages() wasn't even working. I had to create the temp directory manually that it was trying to access. I've previously installed/uninstalled R on my machine before, so I'm guessing some of these problems might be stemming from that. I can now view my installed packages.
If I try something as simple as install.packages("tidyverse"), I'll get the following:
Installing package into
‘C:/Users/areynolds/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Error in readRDS(dest) : unknown input format
Attempting update.packages() yields the same error. I've deleted my .Rhistory which saves to my Documents folder. My .libPaths() is the following:
[1] "C:/Users/areynolds/Documents/R/win-library/3.4"
[2] "C:/Program Files/R/R-3.4.4/library"
I'm not really sure what else to try. I've been looking everywhere for the same problem but it's always a little different. I've tried specifying arguments to install.packages like dependencies = TRUE or lib = path. I'd really appreciate any help. Thanks
I was getting the same error.
Closing RStudio completely, then reopening it worked for me.
Note: simply restarting the R Session (e.g. .rs.restartR()) did not work - I am not sure why

RStudio installation - yaml error messages

Having some issues helping a colleague at work install RStudio. She was getting the following error message whenever she opened up the programme and when trying to install new packages.
Error in yaml.load(readLines(con), error.label = error.label, ...) :
object 'C_unserialize_from_yaml' not found
Error in yaml.load(readLines(con), error.label = error.label, ...) :
object 'C_unserialize_from_yaml' not found
Seems to be the error that's being discussed here. We've followed the steps in the answers and haven't had any luck.
Uninstalled the yaml package, reinstalled RStudio and got a different error message (not surprising given the package was no longer installed).
Error in loadNamespace(name) : there is no package called ‘yaml’
Error in loadNamespace(name) : there is no package called ‘yaml’
Then tried each of the answers in the link and ended up with the original error message again.
Beyond what I've googled in the past 15 minutes, I don't know anything about yaml or what it's supposed to do. Opening R rather than RStudio seems to work as it should.
R version is 3.4.3, RStudio is 1.1.423 for Windows and yaml version that was originally installed was 2.1.16. Not sure if it's relevant, but we are on work laptops that require us to install new programmes (and in the case of R, packages) into C:\Users\NAME\Desktop\My Software, but that seems to have been done correctly.
Any help greatly appreciated.
Thanks,
James

Error installing packages in Rstudio

I have R 3.2.2 setup installed in my system,with RStudio version 0.99.489. When I tried to install rJava package,
install.packages("rJava")
I am getting following Error:
Warning in install.packages :
downloaded length 4878 != reported length 200
Error in install.packages : subscript out of bounds
But if I run the below command before installing any package,it works fine, but I don't want to do this every time I install a package.
options(repos=structure(c(CRAN="http://cran.us.r-project.org")))
You can stick the line you want executed at every startup in your .Rprofile file which should be in your home directory. I have 3.2.3 version of R and that worked; however I do get a warning message about using a non-http version of the site.
Similarly to you, I was finding the original repository the system was using was failing to install the packages--not finding the package or downloading a file with too few bytes, perhaps because of a transient problem. You might want to consider not putting this in your .Rprofile file or commenting the line outin case this is a temporary workaround.

Resources