简体   繁体   中英

Error in readRDS(file) : unknown input format

I am trying to install custom packages in my Rprofile.site file. I want to install packages in the site file because I have to install these packages on several users' computers. However, I am getting the following the error whenever I launch R.

Error in readRDS(file) : unknown input format

I have the following code added to the end of my Rprofile.site file.

if(length(grep("customPackage", installed.packages()))==0) {
    install.packages("customPackage", repos=NULL, type="source")
}

The error keeps repeating itself as well until I stop the R session. If I remove that code from the site file and just install the package directly in an R session though it works fine.

The only reason I want to do it in the site file is because I will keep adding more custom packages that need to be installed on each user's machine and I would rather just call it from the site file than have each user install each custom package once.

I tried searching for the error and got a variety of answers which spoke about deleting the .Rhistory file (which I tried, but didn't work), or installing the latest version of R (I am on R-2.15.0 which is the latest version so that won't help either). I was wondering if there was any other solution to fixing this problem.

I had the same error. Simply closing RStudio, then reopening it and trying again is what worked for me. Note that restarting the R session via the RStudio menu or via rs.restartR() didn't work - only closing and reopening RStudio worked. Not sure why.

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