Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install multiple packages?

Tags:

r

packages

How would I got about installing multiple packages in R?

I tried the following code:

install.packages("EIAdata", "gdata", "ggmap", "ggplot2","gridExtra","ISOweek","kobe","lubridate","maps","MASS","memisc","pander","plyr","psych","Quandl","quantmod","reshape2","rgeos","Rgnuplot","RODBC","scales","sp","sqldf","stockPortfolio","stringi","stringr","XLConnect", "xlsReadWrite","zipcode") 

This code works:

install.packages("ggplot2") 

Why won't the line with the multiple packages work?

like image 847
user2946746 Avatar asked Mar 13 '15 20:03

user2946746


People also ask

Can you install multiple packages at once?

You can install multiple packages by passing a vector of package names to the function, for example, install. packages(c("dplyr", "stringr")) . That function will install the requested packages, along with any of their non-optional dependencies.

Can you npm install multiple packages?

Installing multiple packages using package. When you run the npm install command without specifying any package name, then npm will look for an existing package. json file in the current working directory. npm will install all packages listed as dependencies of the project.

How can you install multiple packages using single command?

If you know the name of the package you wish to install, you can install it by using this syntax: sudo apt-get install package1 package2 package3 ... You can see that it is possible to install multiple packages at one time, which is useful for acquiring all of the necessary software for a project in one step.

Can you pip install multiple packages at once?

To pip install more than one Python package, the packages can be listed in line with the same pip install command as long as they are separated with spaces. Here we are installing both scikit-learn and the statsmodel package in one line of code. You can also upgrade multiple packages in one line of code.


1 Answers

Elementary: form a vector via c(...):

 install.packages(c("EIAdata", "gdata", "ggmap", "ggplot2")) # rest omitted 

so that you have one first argument of length > 1.

Personally, I prefer install.r from littler so I'd do (at the Unix command-line):

  install.r EIAdata gdata ggmap ggplot2    # rest omitted again 

Note that there is no limit to the number of arguments. It was just easier for me to write this with four packages than the 20-some from your example.

like image 65
Dirk Eddelbuettel Avatar answered Sep 20 '22 09:09

Dirk Eddelbuettel