Thursday, June 16, 2016

How to know whether a package installed in R or not?

To know whether a package installed or not. You just have to execute the following command in console.

grep("abind", row.names(installed.packages()))

This will return 1. Because if you check the package "abind", it is the very first package name in the list of packages in right bottom pane in RStudio. In same way you can also check other packages, say I would like to check if package "semPlot" is installed or not.

> grep("semPlot", row.names(installed.packages()))
integer(0)

Observe the output message it is "integer(0)" which means the package with name "semPlot" is not installed.


No comments:

Post a Comment