Error: could not find function "install.packages" Execution halted

I have tried to install some packages (specified in the Coursera course that I'm working on it), example:

if (!require("BiocManager", quietly = TRUE))

if (!require("BiocManager", quietly = TRUE))

if (!require("BiocManager", quietly = TRUE))

install.packages("snpStats", dependencies = T, force = TRUE)
BiocManager::install("snpStats", dependencies=TRUE)

and I get the same error again and again, like:

" BiocManager::install("bladderbatch")
'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for

replacement repositories:

Bioconductor version 3.15 (BiocManager 1.30.18), R 4.2.1 (2022-06-23 ucrt)
Installing package(s) 'bladderbatch'
installing the source package ‘bladderbatch’

trying URL ''
Content type 'application/x-gzip' length 9640937 bytes (9.2 MB)
downloaded 9.2 MB

Error: could not find function "install.packages"
Execution halted

The downloaded source packages are in

  • ‘C:\Users\pc-17-\AppData\Local\Temp\Rtmpu0LXuS\downloaded_packages’*
    Old packages: 'data.table', 'minqa', 'wk', 'cluster', 'commonmark', 'digest', 'foreign',
  • 'jsonlite', 'MASS', 'Matrix', 'mgcv', 'nlme', 'nnet', 'openssl', 'rpart', 'survival', 'sys',*
  • 'vctrs', 'xfun', 'yaml'*
    Update all/some/none? [a/s/n]: "

So, I uninstalled and installed the R program and Rstudio and I don't know what can I do to fix this error.

This topic was automatically closed 42 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.