我正在制作一个应用程序,询问用户一些基本的调查问题.完成后,要求他们通过滑动条提供数字输入,按继续,然后生成绘图,再次询问用户输入,更新绘图等.第一个输入应该是绘图上的y1,第二个输入应该是输入应该是图上的y2,等等.但另外我想保存用户输入的数据,这样我就可以在全局的R脚本中访问它,所以可以使用sendmailR将它发送给我,这样它就可以作为文本文件下载到我的计算机上.但我无法弄清楚如何做到这一点.这是我到目前为止所拥有的.
n=10 #number of times to ask the user for input which will be stored in harv[i]
Time = seq(n)
harv = rep(0,n) #initializing vector for storage of user input at time 1 through n
############### define server logic
shinyServer(function(input, output){
# Compute the forumla text in a reactive expression since it is
# shared by the output$caption and output$mpgPlot expressions
for(i in Time){
# generate a plot
output$yieldplot <- renderPlot({
harv[i] = input$harvest
plot(Time, harv, type='p', ylim=c(0,1))
})
}#for …Run Code Online (Sandbox Code Playgroud)