1

I've recently came across Deducer, it crossed my mind to have a look at it and I progressed to installing the package. After searching through CRAN it occurred to me that there is a number of packages that support Deducer:

packs

Instead of running:

install.packages("Deducer")
install.packages("DeducerExtras")

I would prefer to run a loop for all the packages that have Deducer string in the name. Hence my question, how can I get list of packages from CRAN where name matches specific string and install them in a loop?

Konrad
  • 17,740
  • 16
  • 106
  • 167

1 Answers1

3

Quite raw:

out <- available.packages()
libs <- as.vector(out[grep("Deducer", out[,1]),1])
lapply(libs, install.packages)
  • If someone has some idea for improvement, please feel free to edit. –  Sep 30 '15 at 09:17
  • Thanks very much, this is neat solution. I'm guessing that it would be also useful to run a `grep` with [a list of patterns](http://stackoverflow.com/a/7664655/1655567) so the one could install a number of related packages in the same time, like `grid` and `ggplpot` as well as `ggthemes`. – Konrad Sep 30 '15 at 09:18