Hi, It's as the title says, for some reason, RStudio can't find the install.packages
function, or at least, that's what it says. If I run install.packages("package")
, it's clearly there and runs but fails, midway through. Here's an example (happens with other packages I tried too):
> install.packages("xml2")
Installing package into ‘/home/ydeng/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/xml2_1.3.2.tar.gz'
Content type 'application/x-gzip' length 271876 bytes (265 KB)
==================================================
downloaded 265 KB
Loading local functions ...Error in install.packages("httr") :
could not find function "install.packages"
Calls: source ... eval -> eval -> source -> withVisible -> eval -> eval
Execution halted
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpsaepDQ/downloaded_packages’
Interestingly enough, if I run the command in a normal terminal running R, it works fine after prompting for selecting a secure CRAN mirror.
Any help is appreciated!