create dynamic formula in shiny


I am trying to create an app where user can upload data perform analysis using a formulae and plot using ggplot2. The formula should looks something like f1 and runs perfectly fine when there is only one grouping variable. However, I would like to add multiple grouping variables and then run the analysis. So might looks something like f2. And this input will be from the sever where select input multiple=True has been enabled.

  f1 = as.formula(paste(input$dv,"~",input$time,"|",input$id))
  f2= as.formula(paste(input$dv,"~",input$time,"|",input$id,"+",input$gender))

server select input

selectInput('group','grouping var'," ",selected="",multiple = TRUE)

Finally after the analysis I want to use the same grouping variable to facet in ggplot2.

Thank you,

Aside from writing an entire application for you is there anything else you'd like us to do?

:stuck_out_tongue: but seriously , you will likely get more useful help here if you ask consice and specific questions that target particular challenges you face. Reprex also. FAQ: How to do a minimal reproducible example ( reprex ) for beginners

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.