简体   繁体   中英

How to install cran packages on Windows?

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM