教材要求安裝SIT,也就是「系統投資者工具箱」Systematic Investor Toolbox (SIT) 。html
我很天然的使用CRAN安裝SITgit
> 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
傷心了竟然不能自動安裝。github
我看了一下官網的安裝說明。彷佛不難。可是,我有一個感受只要是不能CRAN安裝的包,總會遇到一些問題,好比外網問題。很煩人。shell
> 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安裝包,而後本地安裝就行。segmentfault
不過沒想到github網站竟然老是出現安全連接失敗。在瀏覽器上也如此。只能多試幾回,最後人品回覆正常,能夠下載了。windows
> 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 >
感謝閱讀,歡迎關注和留言> 感謝閱讀,歡迎關注和留言 量化投資與期貨外匯散仙,基金保險水平也拿的出手