Waldir Leoncio Waldir Leoncio - 1 year ago 107
R Question

Check for installed packages before running install.packages()

I have an R script that is shared with several users on different computers. One of its lines contains the


The problem is that every time someone runs the script, R spends a great deal of time apparently reinstalling the package (it actually does take some time, since the real case has vector of several packages).

How can I make first check if the packages are installed and then only run
for the ones that are not?

Answer Source

try: require("xtable") or "xtable" %in% rownames(installed.packages())

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download