How to install cran packages on Windows?

16,078

Solution 1

As hinted at in the comment, installing and gaining access to packages is a two step process. You've got the first step down with install.packages() but then you also need to load the library in your R script to gain access to those functions with library(YourPackageHere).

See this question for other details.

Solution 2

A copy of An Introduction to R comes with your R installation. Had you glanced at the Table of Contents, you would have seen the Packages section, where your question is answered in the second sentence.

Share:
16,078
rsk82
Author by

rsk82

Updated on July 13, 2022

Comments

  • rsk82
    rsk82 almost 2 years

    I'm typing for example:

    install.packages('TTR')
    

    output is:

    --- Please select a CRAN mirror for use in this session ---
    trying URL 'http://mirrors.softliste.de/cran/bin/windows/contrib/2.12/TTR_0.20-2.zip'
    Content type 'application/zip' length 237131 bytes (231 Kb)
    opened URL
    downloaded 231 Kb
    
    package 'TTR' successfully unpacked and MD5 sums checked
    
    The downloaded packages are in
            C:\Documents and Settings\Administrator\Local Settings\Temp\Rtmp33oIzT\downloaded_packages
    

    But then, even after restarting environment functions belonging to that package aren't recognized, for example EMA() -> Error: could not find function "EMA". Is there any command command to actually install these downloaded packages.

    There is "R CMD INSTALL" command to use in shell but when I type:

    R CMD INSTALL TTR
    

    I get:

    Warning: invalid package 'TTR'
    Error: ERROR: no packages specified