教材要求安装SIT,也就是“系统投资者工具箱”Systematic Investor Toolbox (SIT) 。
我很自然的使用CRAN安装SIT
> install.packages("SIT")
Warning in install.packages :
package ‘SIT’ is not available (for R version 3.6.2)
> install.packages('curl', repos = 'http://cran.r-project.org')
Error in install.packages : Updating loaded packages
伤心了居然不能自动安装。
我看了一下http://systematicinvestor.github.io/about/的安装说明。似乎不难。但是,我有一个感觉只要是不能CRAN安装的包,总会遇到一些问题,比如外网问题。很烦人。
安装 curl和devtools
> install.packages("curl", repos = "http://cran.r-project.org")
trying URL 'http://cran.r-project.org/bin/windows/contrib/3.6/curl_4.3.zip'
Content type 'application/zip' length 4129433 bytes (3.9 MB)
downloaded 3.9 MB
package ‘curl’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\chang\AppData\Local\Temp\Rtmp0mIBQf\downloaded_packages
> devtools::install_github('systematicinvestor/SIT.date')
WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools custom from http://cran.r-project.org/bin/windows/Rtools/.
Downloading GitHub repo systematicinvestor/SIT.date@master
These packages have more recent versions available.
Which would you like to update?
1: All
2: CRAN packages only
3: None
4: stringi (1.4.4 -> 1.4.5) [CRAN]
5: zoo (1.8-6 -> 1.8-7) [CRAN]
Enter one or more numbers, or an empty line to skip updates:
WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools custom from http://cran.r-project.org/bin/windows/Rtools/.
√ checking for file 'C:\Users\chang\AppData\Local\Temp\Rtmp0mIBQf\remotes3b0c253912c1\systematicinvestor-SIT.date-2713207/DESCRIPTION' ...
- preparing 'SIT.date':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- building 'SIT.date_0.1.tar.gz'
* installing *source* package 'SIT.date' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'SIT.date'
finding HTML links ... 好了
businessDateFunctions html
DateFunctions html
DateFunctionsIndex html
DateFunctionsMap html
apply.business.days html
business.days html
business.days.location.end html
custom.date html
custom.date.bus html
date.ends html
date.ends.index html
third.friday.month html
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (SIT.date)
从github上面下载SIT安装包,然后本地安装就行。
不过没想到github网站居然总是出现安全链接失败。在浏览器上也如此。只能多试几次,最后人品回复正常,可以下载了。
> library(curl)
> curl_download('https://github.com/systematicinvestor/SIT/raw/master/SIT.tar.gz', 'sit',mode = 'wb',quiet=T)
Error in curl_download("https://github.com/systematicinvestor/SIT/raw/master/SIT.tar.gz", :
schannel: failed to receive handshake, SSL/TLS connection failed
> curl_download('https://github.com/systematicinvestor/SIT/raw/master/SIT.tar.gz', 'sit',mode = 'wb',quiet=T)
> install.packages('sit', repos = NULL, type='source')
* installing *source* package 'SIT' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
Warning: C:/Users/chang/AppData/Local/Temp/RtmpqMR8jO/R.INSTALL4a0a467614/SIT/man/plot.txt.Rd:21: unexpected section header '\value'
Warning: C:/Users/chang/AppData/Local/Temp/RtmpqMR8jO/R.INSTALL4a0a467614/SIT/man/plot.txt.Rd:24: unexpected section header '\description'
Warning: C:/Users/chang/AppData/Local/Temp/RtmpqMR8jO/R.INSTALL4a0a467614/SIT/man/plot.txt.Rd:29: unexpected section header '\details'
Warning: C:/Users/chang/AppData/Local/Temp/RtmpqMR8jO/R.INSTALL4a0a467614/SIT/man/plot.txt.Rd:34: unexpected section header '\examples'
Warning: C:/Users/chang/AppData/Local/Temp/RtmpqMR8jO/R.INSTALL4a0a467614/SIT/man/plot.txt.Rd:46: unexpected END_OF_INPUT '
'
*** installing help indices
converting help for package 'SIT'
finding HTML links ... 好了
DataFTFunctions html
EnvironmentFunctions html
FileFunctions html
FilenameFunctions html
ListEnvFunctions html
PlotaColorTheme html
SIT html
StringFunctions html
TimingFunctions html
XTSFunctions html
beta.degree html
bt.append.today html
bt.apply.min.weight html
bt.apply.round.weight html
bt.make.cashflow.event.summary.table html
bt.make.trade.event.summary.table html
bt.prep.trim html
bt.run.share.ex html
bt.run.share.ex.allocate html
bt.run.share.ex.invest html
bt.run.share.ex.test html
bt.run.share.ex.test.cashflow html
bt.run.share.ex.test.tax html
bt.run.share.unadjusted.test html
bt.run.share.unadjusted.test.data html
bt.start.dates html
bt.unadjusted.add.div.split html
clusterApplyLB.log html
col.add.alpha html
compute.cor html
convert2expr html
count html
create.monthly.table html
createNonReactiveTextInput html
finding level-2 HTML links ... done
dates2index html
default.round.lot.control html
default.tax.control html
event.at html
find.names html
flip.xts html
fred.fx.symbol html
fxhistoricaldata.fx.symbol html
getSymbols.extra html
getSymbols.intraday html
getSymbols.sit html
hist.quotes.url html
ifna html
ifnull html
iif html
iline html
index.xts html
join html
len html
load.packages html
lookup.index html
lst html
make.stock.xts html
make.xts html
map2monthly html
map2vector html
mat html
mlag html
mlast html
plot.table html
plot.txt html
plot12month.rolling.spread html
plota html
plota.add.copyright html
plota.format html
plota.grid html
plota.layout html
plota.legend html
plota.lines html
plota.matplot html
plota.recession html
plota.stacked html
Rd warning: C:/Users/chang/AppData/Local/Temp/RtmpqMR8jO/R.INSTALL4a0a467614/SIT/man/plota.stacked.Rd:18: missing link 'plota.colors(ncol(y))'
plota.text html
plota.x.highlight html
plota.y.highlight html
plota2Y html
proxy.overlay.plot html
proxy.prices html
proxy.test html
read.xts html
rep.col html
rep.row html
repmat html
rev.map html
round.lot html
round.lot.basic html
round.lot.basic.base html
run.count html
scale.one html
setup.cluster html
spl html
string.buffer html
tableColor html
tax.cashflows html
test.equality html
trim html
vec html
verify.control html
visualize.system.parameter.optimization
html
write.xts html
xts2ts html
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (SIT)
>
> library(SIT)
载入需要的程辑包:SIT.date
载入程辑包:‘SIT’
The following object is masked from ‘package:base’:
close
>
感谢阅读,欢迎关注和留言
量化投资与期货外汇散仙,基金保险水平也拿的出手
,