IniziaInizia gratis

Load an R Package

There are basically two extremely important functions when it comes down to using R packages:

  • install.packages(), which as you can expect, installs a given package.
  • library() which loads packages, making them available to use in your R workspace.

To install packages, you need administrator privileges. This means that install.packages() will not work in the DataCamp interface. However, the most popular CRAN packages are already installed on our servers. You can load them with library().

Questo esercizio fa parte del corso

Intermediate R

Visualizza il corso

Istruzioni dell'esercizio

  • Load the ggplot2 package; make sure you are loading (and not installing) the package!
  • Run qplot(mtcars$wt, mtcars$hp) to verify that the qplot() function from ggplot2 is available.
  • Finally, use the search() function to list the packages that are loaded in your workspace.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Load the ggplot2 package
___

# Retry the qplot() function
___

# Check out the currently attached packages again
___
Modifica ed esegui il codice