installed.packages() doesn't show priority

Viewed 44

When I run the installed.packages() command in the console in order to see which packages I have installed and which loaded, I get the following:

installed.packages() Package LibPath Version Priority
askpass "askpass" "C:/Users/sergi/AppData/Local/R/win-library/4.2" "1.1" NA
assertthat "assertthat" "C:/Users/sergi/AppData/Local/R/win-library/4.2" "0.2.1" NA
backports "backports" "C:/Users/sergi/AppData/Local/R/win-library/4.2" "1.4.1" NA
base64enc "base64enc" "C:/Users/sergi/AppData/Local/R/win-library/4.2" "0.1-3" NA

As you can see, all packages have 'NA' as their value in the priority column, thus one can't really know which ones are loaded or not.

1 Answers

By default, the priority is NULL or NA. According to `?installed.packages

priority - character vector or NULL (default). If non-null, used to select packages; "high" is equivalent to c("base", "recommended"). To select all packages without an assigned priority use priority = "NA".

If we want to get the packages with high priority, use

installed.packages(priority = "high")

-checking

> head(installed.packages(priority = "high")[, 
       c("Package", "Version", "Priority")] )
          Package     Version  Priority     
base      "base"      "4.2.0"  "base"       
boot      "boot"      "1.3-28" "recommended"
class     "class"     "7.3-20" "recommended"
cluster   "cluster"   "2.1.3"  "recommended"
codetools "codetools" "0.2-18" "recommended"
compiler  "compiler"  "4.2.0"  "base"       
Related