Create a dynamic dataframe based on user's inputs in Shiny UI

shiny
rstudio

#1

Need to test a regression model based on test data provided by user on Shiny UI.
User might enter number of observations for testing dataset and then enter respective values in independent variables.
Please advise.


#2

Can you provide an example of what you are trying to achieve and your current solution? It will be easier to improve on something rather than writing everything from scratch.


#3

Thanks.
I am running a regression model using an available training dataset, say 1000 observations and 5 independent variables.

Now I want to run this model against a test dataset. So I am trying to fetch test dataset manually from user on Shiny UI.
User should have an option to select number of observations in test dataset, for e.g. 50 observations.
Once the user provides number of observations, user should be able to view a table of 50 rows and independent variables (or any other view).
User should now be able to enter arbitrary values manually in these 50 rows for each independent variable on Shiny UI.

Currently, I am able to fetch only 1 observation from user for each variable after running below code for UI.

UI Code:

ui<-shinyUI(fluidPage(

Application title

titlePanel(“Model”),

Sidebar with a slider input

sidebarLayout(
sidebarPanel(
sliderInput(“Var1”,label=“Variable 1”,min=100,max=1000,value=“200”,step=1),
sliderInput(“Var2”,label=“Variable 2”,min=500,max=800,value=“600”,step=1),
sliderInput(“Var3”,label=“Variable 3”,min=0,max=1,value=“0.5”,step=0.01),
sliderInput(“Var4”,label=“Variable 4”,min=1,max=20,value=“5”,step=1),
sliderInput(“Var5”,label=“Variable 5”,min=0,max=1,value=“0.6”,step=0.01),
actionButton(“Run_model”, “Run model”)
),

mainPanel(
  
  tabsetPanel(
    tabPanel("model summary", verbatimTextOutput('summary')),
    )
)

)))