When we need packages in R we install them. May be some time you wanted to have a look what packages were installed in your system and also what there version numbers are. Although rarely you would like to do this, here is a small tip on how to do it.
Launch R and execute the following command
> packinfo <- installed.packages ()
This will return a list of packages installed and a lot of other details like Version, License, LibPath indicating where it is installed etc. Check out what information is given by executing
> colnames (packinfo) [1] "Package" "LibPath" "Version" "Priority" "Depends" "Imports" [7] "LinkingTo" "Suggests" "Enhances" "OS_type" "License" "Built"
Now simply display the Package and Version fields to have a look at the list of package installed in your system.
> packinfo[,c("Package", "Version")] . . output truncated . .
If you know the package name and want to see the version then you can just provide the list of package name strings, for example
> packinfo[c("RANN", "fpc", "RSNNS", "elmNN"),c("Package", "Version")] Package Version RANN "RANN" "2.1.3" fpc "fpc" "1.2-4" RSNNS "RSNNS" "0.4-3" elmNN "elmNN" "1.0"
This post was a derivative of my answer here in stackoverflow