Error: could not find function "install.packages" for R markdown

anytime I go to knit a new R markdown doc, an error appears in the 'Render" tab;

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

I have run the markdown script on other computers and it works fine. I have uninstalled and reinstalled R, R studio, and R tools. I have tried this with both versions 4.1 and 4.2, both have the same problem.
Also, upon starting up R-studio, the
Error: could not find function "install.packages"
appears in the console tab as well.

All other functions work, I can install packages, load packages, do analysis etc., it is just when I go to knit an R markdown script does the error affect functionality.

Any help on this matter would be greatly appreciated.
Thank you

This suggest you have a .Rprofile file with an install command on it. Look for it and remove the command

ah, thank you, found it and deleted it.
All fixed.

1 Like

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

right I see,
thanks for letting me know.
All done now

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.