Error: could not find function "update.packages" on start up, and cannot render in knitr

Upon start up in R studio, the R console shows:

Error: could not find function "update.packages"

I attempted to render a document with R markdown, though an error message was returned:

Error: could not find function "update.packages"

Not sure that a discrepancy in the file paths using find.package("utils") and path.package("utils") is a contributing factor/issue

Any help is greatly appreciated.

R version 4.3.2 (2023-10-31 ucrt) -- "Eye Holes"
R studio (2023.09.1 Build 494)
Platform: x86_64-w64-mingw32/x64 (64-bit)

I do not think you can update packages in an Rmd document /environment.

If you want to update packages you should do it in the General Environment, that is the one that loads automatically when you start RStudio normally.

You mean you did not run that function yourself? Do you have update.packages() in your .Rprofile file?

The update .packages() command comes up during start up, I didn't put it in the Rmd document, when pressing the knit but the render tab opens and shows the error message.

R on start up

Render tab after pressing knit

I did not run that function, that is what shows on start up. update.packages() is not in my .Rprofile file.

Sorry, I meant your user's profile, not the system profile, i.e. what is the output of this?


Make sure that you omit sensitive information!

Also, please copy and paste the output between markdown fences, i.e. three ``` characters, like this :

<your output>

The output I received are:

update.packages(ask = FALSE)

Yes, so you do have update.packages() in your profile. Remove that line from ~/.Rprofile.

That worked! thanks so much I have some research to do on what .RProfile is and why it is important.

Every time an R process starts up, it runs the code from your .Rprofile. See


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.