Possible Duplicate:
Cannot install R-forge package using install.packages
Has anyone gotten the latest version of TTR from R-forge working on R 2.13? I can't install it on either my mac or my PC, even if I try compiling from the source.
/edit: here's the exact error I'm getting, when I try to install from the R command line.
install.packages("TTR", repos="http://R-Forge.R-project.org")
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘TTR’ is not available (for开发者_JAVA技巧 R version 2.13.0)
Yes, sure:
edd@max:~/svn/ttr$ svn up
At revision 107.
edd@max:~/svn/ttr$ R CMD INSTALL .
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘TTR’ ...
** libs
make: Nothing to be done for `all'.
installing to /usr/local/lib/R/site-library/TTR/libs
** R
** data
** preparing package for lazy loading
Loading required package: zoo
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
* DONE (TTR)
and
edd@max:~/svn/ttr$ R -e 'library(TTR); example(EMA)'
R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)
[...]
R> library(TTR); example(EMA)
Loading required package: xts
Loading required package: zoo
EMAR> data(ttrc)
EMAR> ema.20 <- EMA(ttrc[,"Close"], 20)
EMAR> sma.20 <- SMA(ttrc[,"Close"], 20)
EMAR> dema.20 <- DEMA(ttrc[,"Close"], 20)
EMAR> evwma.20 <- EVWMA(ttrc[,"Close"], ttrc[,"Volume"], 20)
EMAR> zlema.20 <- ZLEMA(ttrc[,"Close"], 20)
EMAR> ## Example of Tim Tillson's T3 indicator
EMAR> T3 <- function(x, n=10, v=1) DEMA(DEMA(DEMA(x,n,v),n,v),n,v)
EMAR> t3 <- T3(ttrc[,"Close"])
EMAR> ## Example of short-term instability of EMA
EMAR> ## (and other indicators mentioned above)
EMAR> x <- rnorm(100)
EMAR> tail( EMA(x[90:100],10), 1 )
[1] 0.192859
EMAR> tail( EMA(x[70:100],10), 1 )
[1] 0.149217
EMAR> tail( EMA(x[50:100],10), 1 )
[1] 0.153751
EMAR> tail( EMA(x[30:100],10), 1 )
[1] 0.153703
EMAR> tail( EMA(x[10:100],10), 1 )
[1] 0.153703
EMAR> tail( EMA(x[ 1:100],10), 1 )
[1] 0.153703
R>
The News says it's now on CRAN. My Mac has 0.20-2 on it and the installer reports that to be the most recent. Loading seems to succeed and no errors from running a few examples.
Re the r-forge version 20-3 I get this:
install.packages("TTR", repos="http://R-Forge.R-project.org") Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘TTR’ is not available (for R version 2.13.0 beta)
R version 2.13.0 beta (2011-04-04 r55296) (not the latest)
精彩评论