Skip to content

Instantly share code, notes, and snippets.

@benmarwick
Last active February 21, 2021 01:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save benmarwick/5054846 to your computer and use it in GitHub Desktop.
Save benmarwick/5054846 to your computer and use it in GitHub Desktop.
A method to automatically download, install and load R packages that only requires the package name to be typed once. Credits: http://stackoverflow.com/a/8176099/1036500 & http://stackoverflow.com/a/4090208/1036500
list.of.packages <- c("xx", "yy") # replace xx and yy with package names
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
lapply(list.of.packages, require, character.only=T)
@sterkhedkar
Copy link

@

hi all,
thanks for your code..

I have a probelm with random forest package can you plz suggest me a solution for my problem i will share the details
screenshot from 2018-08-23 11-08-36

i have this problem can you resolve
thanks in advance

install these libgfortran4.3, gcc-43fortran and gcc-fortran

@Howquez
Copy link

Howquez commented Feb 19, 2020

Salut,

do you have suggestions on how to (elegantly) include githubinstall() or install_github() to this?

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment