Saturday, January 7, 2023

Package Installation in R

Installation and activation of the package are very important to perform any function. R cannot perform any function if require package is not present in its library. By following codes, you can install single, or multiple packages and can activate them

 #--- Install single package

install.packages("lsmeans")

# Activate package

library(lsmeans)

#-- Install multiple packages

install.packages(c("knitr","emmeans","e1071","data.table"))

#--Make a list

my_packages <- c("knitr","emmeans","e1071","data.table")

#---Activate list of packages

lapply(my_packages, require, character.only = TRUE) 

   #---Activate all of packages of library       

lapply(my_packages, require, character.only = TRUE)

No comments:

Post a Comment