Can not install any packages both in R and Rstudio in a sudden. It had Rtool warnings before, but the package could be installed. It doesn't work now. I tried double click yes and reinstall R but didn't work.

WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

Installing package into ‘C:/Users/kisei/OneDrive/文档/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
'lib = "C:/Users/kisei/OneDrive/<U+6587><U+6863>/R/win-library/3.6"' is not writable

##here I double click "Yes" to use a personal library.
Warning in install.packages :
cannot create dir 'C:\Users\kisei\OneDrive??', reason 'Invalid argument'
Error in install.packages : unable to create ‘C:/Users/kisei/OneDrive/??/R/win-library/3.6’
Warning message:
In readChar(con, 5L, useBytes = TRUE) :
cannot open compressed file 'C:/Users/kisei/OneDrive/??/.RData', probable reason 'Invalid argument'

I see two challenges right away, the use of OneDrive for the libraries, and non-standard characters in the filepaths. There may be workarounds for both of these, but by far the easiest thing (from an R point of view) may be to define R's libpath to some simple pathname on raw C:\ outside of onedrive context.
How to Change the Default Library in Rstudio to a Different Default Library or Custom Library (

1 Like

Thank you so much for your help. Solved!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.