0
好的,所以我確信我錯誤地提出了這個問題,但是有什麼辦法可以完成在Shiny中輸入1到控制檯中的等效功能。如何在交互功能中輸入控制檯等效命令?
基本上我想下面的閃亮工作:
library(quantmod)
library(fPortfolio)
# Get data
data1 <- getSymbols(c("VEU","SPY","VWO","AGG"),
from = "2016-01-01",
to = "2017-01-01")
data2 <- do.call(merge, lapply(data1, function(x) Ad(get(x))))
data3 <- na.omit(ROC(data2,n = 1,"discrete"))
colnames(data3) <- gsub(".Adjusted","",colnames(data3))
data4 <- as.timeSeries(data3)
# fPortfolio options
portfolioOptions<-portfolioFrontier(data4)
plot(portfolioOptions)
這一點,我們在控制檯中以下後:
Make a plot selection (or 0 to exit):
1: Plot Efficient Frontier
2: Add Minimum Risk Portfolio
3: Add Tangency Portfolio
4: Add Risk/Return of Single Assets
5: Add Equal Weights Portfolio
6: Add Two Asset Frontiers [LongOnly Only]
7: Add Monte Carlo Portfolios
8: Add Sharpe Ratio [Markowitz PF Only]
Selection:
有什麼辦法輸入1-8成選擇在閃亮和渲染情節相應?
一系列的複選框會做你想要什麼。 –