R to return the package license?

I would like to return the license of the package, as indicated in the DESCRIPTION file of package R (ideally, I would prefer a URL that CRAN automatically adds to all the common licenses that it recognizes).

I understand that I can get a license. R itself is distributed using

license() 

which surprisingly does not apply to packages; e.g. license ("package_name")

This data is returned when calling citation("packagename") .

+6
source share
2 answers

are you looking for packageDescription

eg:

 packageDescription("stats", fields="License") [1] "Part of R 2.15.3" packageDescription("ggplot2", fields="License") [1] "GPL-2" 
+12
source

If you want to obtain licenses for all installed packages, use the installed.packages command.

Borrowing from the help page for this command:

 lisc <- installed.packages(fields = "License") 

To output licenses to a csv file:

 write.csv(lisc[,c(1,10)], "RPackageLicenses.csv") 
+2
source

Source: https://habr.com/ru/post/948872/


All Articles