You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know how you would put this in, but when I first learned R, I found it really annoying typing "library()" over and over. Then, a professor taught me about the pacman package and p_load, where it checks to see if the package is installed first, installs it if it isn't, and then runs the library function. I put this code at the top of all my scripts:
# Check for pacman package
if (!require("pacman")
) install.packages("pacman")
# Packages
pacman::p_load(
#add list of packages here
)
The packages are just comma-separated, making for much cleaner code. I wish someone had taught me this tip much earlier.
The text was updated successfully, but these errors were encountered:
I don't know how you would put this in, but when I first learned R, I found it really annoying typing "library()" over and over. Then, a professor taught me about the pacman package and p_load, where it checks to see if the package is installed first, installs it if it isn't, and then runs the library function. I put this code at the top of all my scripts:
The packages are just comma-separated, making for much cleaner code. I wish someone had taught me this tip much earlier.
The text was updated successfully, but these errors were encountered: