partly upload your input from a file

52 views Asked by At

I have a question about shiny. Can I partly take my input from a file. For example I have 10 variables, 6 of them I introduce from keyboard and the rest of them, 4 I want to upload from a file. Is something like this possible with shiny? My server.R looks something like this:

results<-simSIR(nsimulations=input$nsimulations, 
                    ncows=input$ncows, 
                    nvaccinated=input$nvaccinated, 
                    ninfectedinit=input$ninfectedinit, 
                    initvaccination=input$initvaccination, 
                    p=input$p,
                    freqvacc=input$freqvacc,
                    noutbreaks=input$noutbreaks,
                    lambdaiv=input$lambdaiv,  
                    lambdain=input$lambdain,  
                    muiv=input$muiv,
                    muin=input$muin,
                    an=input$an, 
                    bn=input$bn, 
                    av=input$av, 
                    bv=input$bv,
                    cost_vaccination=input$cost_vaccination,
                    daily_milk=input$daily_milk,
                    price_liter=input$price_liter,
                    grafic=F, 
                    parameters=T, 
                    writeitdown=F
    )

  })

And as you see I take from input all, and I wanted to take some parameters like: lambaiv,lambain,muiv,muin,an,bn,bv,av from a text file. Thank you in advance!

1

There are 1 answers

2
Cory Charlton On

It's not clear what you have tried so far or what exactly you want to accomplish but this tutorial shows how to work with data files.

The key in that tutorial seems to be:

counties <- readRDS("census-app/data/counties.rds")

The is also an example using the reactiveFileReader at this link.

fileData <- reactiveFileReader(1000, session, 'data.csv', read.csv)