error in install packages

I am trying to install packages in Rstudio such as mpg, and I get an error message. what should I do?
*if I try to install the package in R (not Rstudio), it works, though I want to be able to download package directly in Rstudio.

thanks!

Hi, and welcome.

A reproducible example, called a reprex is always more helpful than a screenshot.

Here's why. There is no "mpg" package on CRAN, so I have to assume you were trying to bulk install packages by defining "mpg" as a collection of packages. However, if you did this with

mpg <- c("abc","def","hgi")
install.packages(mpg) # no quotes

it would work. In this case, only for abc, which is an actual package, but not for the others.

In RStudio, use the Tools | Install Packages dialog box, and separate multiple package names with a space or comma.

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