[R] Installing packages based on the license

Charles C. Berry cberry at tajo.ucsd.edu
Wed Nov 26 23:27:33 CET 2008

On Wed, 26 Nov 2008, Ted Mendum wrote:

> Hello,
> I would like have an automatic way to avoid installing packages that I cannot use due to license restrictions.
> For example, the conf.design package is limited to non-commercial use, and since I work for a for-profit business, I cannot use it.
> I found out about the license terms of conf.design by chance; I would like to avoid any possibility of a mistake in the future.
> Is there some clever combination of grep and install.packages that I could use to limit my downloads to, say, GPL-only packages?

Something like:

> txt <- readLines(url("http://cran.r-project.org/web/packages/ALS/index.html"))
> aok <- regexpr("GPL",txt[grep("License",txt)+1])>0

will work on CRAN as it is formatted now. Maybe roll it up in a function, 
say license.ok(), that returns the name of package if aok or print the 
license and stop if not aok. Then install.packages(license.ok(pkg.name))
should do it. Of course, this does not handle dependencies. For that you 
might want to parse with index.html with XML, follow the dependencies and 
check them all out, first.



> Thanks,
> Ted
> Ted Mendum | Senior Scientist
> Warner Babcock Institute for Green Chemistry
> 66 Cummings Park, Woburn, MA 01801
> p:   781-937-9000  
> f:    781-937-9001
> ted.mendum at warnerbabcock.com
> www.warnerbabcock.com
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

More information about the R-help mailing list