Saltar al contenido principal
LibreTexts Español

3.9: Uso de bibliotecas R

  • Page ID
    150450
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Muchas de las características útiles en R no están contenidas en el paquete R primario, sino que provienen de bibliotecas que han sido desarrolladas por varios miembros de la comunidad R. Por ejemplo, el paquete ggplot2 proporciona una serie de características para visualizar datos, como veremos en un capítulo posterior. Antes de poder usar un paquete, necesitamos instalarlo en nuestro sistema, usando la función install.packages ():

    > install.packages("ggplot2")
    trying URL 'https://cran.rstudio.com/...
    Content type 'application/x-gzip' length 3961383 bytes (3.8 MB)
    ==================================================
    downloaded 3.8 MB
    
    
    The downloaded binary packages are in
        /var/folders/.../downloaded_packages
    

    Esto descargará automáticamente el paquete de la Comprehensive R Archive Network (CRAN) y lo instalará en su sistema. Una vez instalada, puedes cargar la biblioteca usando la función library ():

    > library(ggplot2)

    Después de cargar la función, ahora puede acceder a todas sus funciones. Si quieres conocer más sobre sus características, puedes encontrarlas usando la función de ayuda:

    > help(ggplot2)

    This page titled 3.9: Uso de bibliotecas R is shared under a CC BY-NC 2.0 license and was authored, remixed, and/or curated by Russell A. Poldrack via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.