Is there any way to check for missing packages and install them in R

0 votes
I want to check the installed packages, and if any package is not installed then I want to install that particular package
Apr 17, 2018 in Data Analytics by CodingByHeart77
• 3,750 points
884 views

1 answer to this question.

0 votes

There are 2 options:

Either you can use the list of packages and compare it to the output from installed.packages(). After that, you can install the missing packages.

list.of.packages <- c("ggplot2", "Rcpp")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)

OR

You can out your code in a package and make them as dependencies. So they will automatically be installed when you install the required package.

answered Apr 17, 2018 by nirvana
• 3,130 points

Related Questions In Data Analytics

0 votes
1 answer

Is there any easy way to fill in missing data?

You can try the following code: First, you ...READ MORE

answered Jun 20, 2018 in Data Analytics by DataKing99
• 8,250 points
1,102 views
0 votes
1 answer

Is there a way to display correlation in graphical manner in R?

Ans There are multiple ways of getting this. ...READ MORE

answered Nov 26, 2018 in Data Analytics by Maverick
• 10,840 points
561 views
0 votes
1 answer
0 votes
1 answer

Is there a way to make R beep/play a sound?

Yes there are few ways to do ...READ MORE

answered May 25, 2018 in Data Analytics by zombie
• 3,790 points
735 views
0 votes
1 answer

How to install an R package from source?

If you have your file located locally ...READ MORE

answered Apr 14, 2018 in Data Analytics by CodingByHeart77
• 3,750 points
951 views
0 votes
1 answer

Unload a package without restarting R

Try the below option: detach("package:vegan", unload=TRUE) NOTE: You can ...READ MORE

answered Apr 17, 2018 in Data Analytics by DataKing99
• 8,250 points
4,079 views
0 votes
1 answer

Unable to install the 'devtools' package in R

Run the below command in your Ubuntu/Linux ...READ MORE

answered Jun 6, 2018 in Data Analytics by Bharani
• 4,660 points
1,701 views
0 votes
1 answer

R package dplyr reinstall every instance

In R, there are two steps of ...READ MORE

answered Jun 1, 2022 in Data Science by Sohail
• 3,040 points
633 views
0 votes
1 answer

How to convert a list to data frame in R?

Let's assume your list of lists is ...READ MORE

answered Apr 12, 2018 in Data Analytics by nirvana
• 3,130 points

edited Apr 12, 2018 by nirvana 22,136 views
0 votes
1 answer

.SD in data.table in R

.SD stands for "Subset of Data.table". The ...READ MORE

answered Apr 13, 2018 in Data Analytics by nirvana
• 3,130 points
7,114 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP