0

I have a Data frame that I want to draw all the values out of column by column identified by column name. The code below just returns five NULL values where five is the number of columns in my Data frame

for(x in names(DataFrame)){
  print(DataFrame$x)
}

This is the simplified version, but the ultimate goal is a shiny app that turns individual columns into selectInput boxes with this function. I can then modify the number of input boxes just by changing the spreadsheet. Seen below

for(x in names(DataFrame)){
  fluidRow(
    column(3,
       selectInput(paste("Input","x"), h5("x"),
                   choices= DataFrame$x)))}

In short, I want the DataFrame$x to return a list of the things in each column. Now it's returning NULL.

0

1 Answer 1

1

Currently you are trying to print the values in a column named x. If you want to link to a column using a name (string) you should but the string between brackets.

for(x in names(DataFrame)){
    print(DataFrame[[x]])
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.