我试图通过用户输入加载.rdata对象,如果找到该对象,则获取存储在对象中的列表长度,否则长度为1。 我使用以下代码:
output$M_name<-renderUI({
if(file.exists(obj_name())==TRUE)
{
modname<<-load(file=objname,envir=sys.frame())
ver<<- length(get(modname))+1
str1 <- paste0("- ",isolate(input$model_name)," already EXISTS.")
str2 <- paste("- Please upload the new data csv file of the above mentioned model")
HTML(paste(str1, str2, sep = "<br/>"))
}else
{
modname<<-isolate({input$model_name})
ver<<-length(get(modname))+1
str1<-paste0("- ",isolate(input$model_name)," does not EXIST")
str2<-paste("- Please use the same name, if you have already uploaded base model details before")
str3<-paste("- If this is the first time, Please upload the csv file on the next page")
HTML(paste(str1, str2, str3, sep = "<br/>"))
}
})
文件被加载,对象保存在&#34; modname&#34;但我没有看到&#34; ver&#34; r环境中的变量。
我对R闪亮很新,请耐心等待我的编码。