Unable to update R - r

I have 4.0.2 version and I want to update it. So I install installr and I tried to use updateR():
install.packages("installr")
library(installr)
updateR()
After library(installr) I got a warning message:
Installation status: FALSE . Removing the file:
C:\Users\HP250~1\AppData\Local\Temp\Rtmp2RQ7lv/R-4.0.3-win.exe (In
the future, you may keep the file by setting keep_install_file=TRUE)
[1] FALSE
Warning messages:
1: In download_fun(exe_URL, destfile = exe_filename, quiet = FALSE, :
downloaded length 20258816 != reported length 88237960
2: In shell(install_cmd, wait = wait, ...) : > 'C:\Users\HP250~1\AppData\Local\Temp\Rtmp2RQ7lv/R-4.0.3-win.exe' execution failed with error code 1
but I continue with updateR(). Then it started loading but aftrer fe seconds (at 10-20%) stopped. I got an other warning message:
The setup files are corrupted. Please obtain a new copy of the
program.
What is the problem? How can I fix it?
Thanks in advance!

I deleted Temporary Files and problem solved. I don't know why, but everything is ok now.

Related

Error in install_github: System command 'Rcmd.exe' failed, exit status: 1, stdout & stderr were printed

I was trying to install the package "pgenlibr" in the github, using the command
install_github("chrchang/plink-ng", subdir="/2.0/pgenlibr"), and received the error message.
> install_github("chrchang/plink-ng", subdir="/2.0/pgenlibr")
Downloading GitHub repo chrchang/plink-ng#HEAD
√ checking for file 'C:\Users\86137\AppData\Local\Temp\RtmpILEuSP\remotes109044a8685a\chrchang-plink-ng-73bdbc3\2.0\pgenlibr/DESCRIPTION' ...
Warning in file.copy(pkgname, Tdir, recursive = TRUE, copy.date = TRUE) :
problem copying .\pgenlibr\src\include to C:\Users\86137\AppData\Local\Temp\RtmpaONA8h\Rbuild2e1c6cc05dce\pgenlibr\src\include: Permission denied
Warning in file.copy(pkgname, Tdir, recursive = TRUE, copy.date = TRUE) :
problem copying .\pgenlibr\src\libdeflate to C:\Users\86137\AppData\Local\Temp\RtmpaONA8h\Rbuild2e1c6cc05dce\pgenlibr\src\libdeflate: Permission denied
Warning in file.copy(pkgname, Tdir, recursive = TRUE, copy.date = TRUE) :
problem copying .\pgenlibr\src\zstd to C:\Users\86137\AppData\Local\Temp\RtmpaONA8h\Rbuild2e1c6cc05dce\pgenlibr\src\zstd: Permission denied
ERROR
copying to build directory failed
Error: Failed to install 'pgenlibr' from GitHub:
System command 'Rcmd.exe' failed, exit status: 1, stdout & stderr were printed
I have installed its required software listed on Readme, Rtools, all packages dependencies. I have also tried other methods, delete all Rtmp files, run Rstudio as administrator, cancel "read only" to folder "temp" and "library" in the workpath, but gained no success.
In addition, I'm using Windows 10.
How can I solve this problem?
I have solve this problem on Ubuntu System.
There is a similar problem when installing 'cindex', Here is the a link.
So the reason seems to be that install_github( ) in Win10 can not deal with symlink very well.
I got the same error when I was building the source for an R package and there was a syntax error in the DESCRIPTION file.
To solve, I removed suspected culprits from the DESCRIPTION file and it worked, so then just narrowed down to isolate the offending line (it was a typo in the person() function in my case, but causes my vary).

Permission denied when manually installing R package

Hi I am currently run R code with version 4.1.0 on ubuntu(WSL) right now. I try to install some R packages manually because my internet is too slow, but I cannot get permission, the warning messages suggest the probable reason "permission denied". Here is the error and warning messages.
Warning in dir.create(path, showWarnings = TRUE, recursive = TRUE, ...) :
cannot create dir 'Rhdf5lib_1.14.2/Rhdf5lib', reason 'Permission denied'
Error in mydir.create(name) :
failed to create directory ‘Rhdf5lib_1.14.2/Rhdf5lib’
I really hope someone can help me with this problem, thanks a lot!
Try to start your R session with sudo R. Other possible option is to specify a lib argument like install.packages("SomePackage", lib = "/home/user/R/...")
I try the following command
export PATH=$PATH: path/to/your/R
and run R directly,this works for me.

Warning message: 'c:/Rtools/mingw_/bin/g++' not found

When I try to use RStan (which needs RTools to run) in R, I get the following warning message:
Warning message: In system(paste(CXX, ARGS), ignore.stdout = TRUE,
ignore.stderr = TRUE) : 'c:/Rtools/mingw_/bin/g++' not found
But, when I check in the 'c:/Rtools/' folder, I find two 'mingw_' files, called 'mingw_32' and 'min_gw64', and in both folders there is already a 'bin/g++' file. Why do I get this warning then? Is it wrong to have two folders, one 32 and one 64 bits?
delete your old .Rprofile and try again. This helped in my case

RStudio v1.1.456 Rpubs upload error, no login prompt

Hi I couldn't find any useful information in regards to this one.
When I try to publish to Rpubs on Rstudio v1.1.456, instead of login prompt I get this error message below.
[Edited] Rstudio v1.1.456, R v3.5.1
Upload Error Occurred Error in if (result$status == 201) succeeded <-
TRUE : missing value where TRUE/FALSE needed Calls: In
addition: Warning message: In http(protocol, "api.rpubs.com", port,
method, path, headers, : NAs introduced by coercion Execution
halted
I've already addded this line
options(rpubs.upload.method = "internal")
to both global and working directory Rprofile
Apparently, there was an issue in the most recent version of rsconnect (0.8.12).
devtools::install_github("rstudio/rsconnect", ref = "bugfix/multi-status-header")
Installing the patch solves it.

R installed.packages() randomly stopped working on windows 7

installed.packages() command in R lists your installed packages. Mine was working for almost a year and then this command randomly started throwing an error. As this is a built-in command, I am not even sure how to "reinstall" it or address this. Any ideas how to fix the error and get the command working again?
> installed.packages()
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning message:
In gzfile(file, mode) :
cannot open compressed file `'C:\Users\Mitch\AppData\Local\Temp\Rtmp6Dawpa/libloc_190_4464fd2b.rds', probable reason 'No such file or directory'`
One suggestion on here involved this in combination:
.libPaths()
installed.packages(lib.loc = 'my path')
The results of this produced yet another error as shown here. Looks like an issue with the installed file still but how to address is the question:
> installed.packages(lib.loc = 'C:/ProgramFilesCoders/R/R-3.3.2/library')
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning message:
In gzfile(file, mode) :
cannot open compressed file 'C:\Users\Mitch\AppData\Local\Temp\Rtmp6Dawpa/libloc_190_4464fd2b.rds', probable reason 'No such file or directory'
>
That is odd.
What version of R are you running, standard R or Microsoft R? And did you recently update?
If you did recently update, perhaps your packages did not get copied over, hence the 'No such file or directory' statement.
If you haven't updated, I would install a newer version and see if it fixes the issue.
If your uncertain, you can always use the updateR function to check if you have the latest version and choose to install it or not.
library(installr)
updateR()
Good luck,
I think the issue lies in terms of the where the function is looking for the package information. installed.packages() needs an argument lib.loc.
From official documentation
lib.loc character vector describing the location of R library trees to search through
Looks like the function for some reason is looking in AppData\Local\Temp which is the download location and not the installed location.
Without looking at your R_Home and .libPaths() is difficult to nail down where the problem is, however running .libPaths() should give you one or more paths as shown in the below example. None of these should be temp locations.
>.libPaths()
[1] "C:/Users/UserName/Documents/R/win-library/3.4"
[2] "C:/Program Files/R/R-3.4.0/library"
If not, you can set the path within the .libPaths("your path") or pass the path of the library as part of installed.packages(lib.loc = 'your path') and try again.
Sometimes the most simple obvious solution is what works:
I closed my RStudio environment saving it to .RData
I re-opened RStudio and tried the command again
it worked
For the future, some good ideas got posted on here before I thought to try the above. Here are the suggestions that others included in case the above does not work if this problem is encountered by anyone in the future:
Use .libPaths() to find out proper path where this is installed, and then re-run the command with the path included in it like so: installed.packages(lib.loc = 'your path')
Try debugging it with: debug(installed.packages); Expectation is that we will likely find something wrong with .readPkgDesc(lib, fields) while stepping through debug. This was not tried yet so you may encounter things not written up here when you do try it.
Try Updating R in case it is out of date with these commands: library(installr) and updateR().

Resources