I am trying to write an app that allows a user to create a design object and then download that object as an rda file to be used later. The object is being created and the file is being downloaded, but the data is not being properly written to the file. The code below shows how the design object is created and my attempt at downloading it.
pbDesign<-reactive({
pb(nruns= input$runs ,n12.taguchi= FALSE ,nfactors= input$fac, ncenter= input$nc ,
replications= input$nr ,repeat.only= FALSE ,randomize= rand ,seed= 13851,
factor.names=names)
})
dz <- reactiveValues()
observe({
if(input$act==0)
return()
else
if(!is.null(pbDesign()))
isolate(
dz <- pbDesign()
)
})
output$downloadRDA <- downloadHandler(
filename <- function(){
paste(input$desName,'.rda')
},
content = function(file) {
save(dz, file = file)
}
)
I have tried using the export.design() function in place of save but that does not seem to work either.
this is what gets assigned to dz:
$impl
<ReactiveValues>
Public:
.allValuesDeps: environment
.dependents: environment
.label: reactiveValues4787
.namesDeps: environment
.setLabel: function
.values: environment
.valuesDeps: environment
clone: function
get: function
initialize: function
mset: function
names: function
self: environment
set: function
toList: function
attr(,"class")
[1] "reactivevalues"
attr(,"readonly")
[1] FALSE
I am not sure if it is due to me not properly understanding the downloadHandler function or if it has something to do with my use of the save() function. Is there any function similar to write.csv() but for an rda file?
Any help or advice on this topic would be greatly appreciated.