问题
The question of R "stats" citation for a scientific paper makes me wonder how I would enumerate all the R packages that I ought to cite when using R in an academic paper. How would I get a list of packages that I loaded and need citation?
回答1:
Using the answer to How to find out which package version is loaded in R? , I see that we can use the sessionInfo()
function to see what packages have been loaded (though not necessarily used).
The following gets the base packages as a vector and concatenates it with the names of the loaded packages. Then we apply the citation
function to each.
packages_in_use <- c( sessionInfo()$basePkgs, names( sessionInfo()$loadedOnly ) )
the_citations_list <- lapply( X=packages_in_use, FUN=citation)
the_citations_list
来源:https://stackoverflow.com/questions/27535628/how-do-i-tell-which-r-packages-to-cite-in-my-paper