I want to create a dataframe with columns names given by user.
Like I have some textInputs(name1, name2 etc) and textInputs(value1, value2 etc).
Now I want to create dataframe with entries in name1, name2 as column names and corresponding entries in value1, value2 as dataframe entries.
You could do it as in the following code. In a shiny app the elements of input would come from the widgets and not be coded in the way I show but the principle would be the same.
input <- list()
input$name1 <- "X"
input$name2 <- "Y"
input$value1 <- "THIS"
input$value2 <- "THAT"
DF <- data.frame(input$value1, input$value2)
colnames(DF) <- c(input$name1, input$name2)
DF
#> X Y
#> 1 THIS THAT
Created on 2019-12-17 by the reprex package (v0.3.0.9000)
User have to enter this, that, X,Y from the ui. I am not asking to hard code this. textInputs means the Text-Box which will take entries from the user.
Yes, I understood that the actual inputs would come from the user. That is the meaning of "In a shiny app the elements of input would come from the widgets and not be coded in the way I show"
Here is an example