All, I am trying to write a data frame into RDS file in Shiny app. I am using below code.
AgName <- gsub("\\s","",paste(mtrl1,'_',stage1,'_',sample1,'.RDS', collapse = ' '))
saveRDS(Input_Data2, AgName )
But it is throwing following error message:
Error: cannot open the connection
Same code is running fine on R command line but not in Shiny app. Any help will be highly appreciated. Thanks!
Thanks Flick!
I used below code as well, but no luck.
setwd("/opt/shiny-server/samples/sample-apps/P-AG-Disc4/")
AgName <- gsub("\\s","",paste(mtrl1,'_',stage1,'_',sample1,'.csv', collapse = ' '))
saveRDS(Input_Data2, file=AgName )
Thanks Flick!
You were right. Directory was not having write permission on the directy, where I was trying to write. Thanks again soo much!
I was getting the same issue. I referred to this question and used the below given code to resolve this. I used this code, and it ran fine:
wrtfun2<-reactive({
if (!is.null(input$var1))
setwd("/opt/shiny-server/samples/sample-apps/test")
sink("outfile.txt")
cat(input$var1)
sink()
}
)
I also changed the permission on the directory where I was trying to write and It worked finally.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.