有没有人让latest version of TTR from R-forge在R 2.13上工作?我无法在我的Mac或PC上安装它,即使我尝试从源代码编译。
/ edit:当我尝试从R命令行安装时,这是我得到的确切错误。
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)
答案 0 :(得分:2)
是的,确定:
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)
和
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>
答案 1 :(得分:0)
新闻称它现在在CRAN上。我的Mac上有0.20-2,安装程序报告说这是最新的。加载似乎成功,并且运行一些示例没有错误。
重新制作r-forge版本20-3我得到了这个:
install.packages(“TTR”,repos =“http://R-Forge.R-project.org”) 警告信息: 在getDependencies(pkgs,dependencies,available,lib)中: 包'TTR'不可用(对于R版本2.13.0 beta)
R版本2.13.0 beta(2011-04-04 r55296)(不是最新版本)