Problem with dropping columns in Table Container using Inputs

It's a good idea to get your basic data frame subsetting code working outside of shiny first, before adapting it for use in your app.

Remember that you're subsetting the data frame, not the final displayed table, so you need to use variable names that appear in the data frame (e.g., there is no variable called Sepal in iris). It looks like you need to introduce an intermediate step to translate the values in your UI into values that can be used to subset your data frame. You don't seem to be selecting specific variables, but rather variables that match a pattern (e.g., contain "Sepal" or contain "Length"), so the logic to translate the UI selection into the right set of variable names or indices needs to reflect that.

Also, what do you expect to happen to the Species column when someone selects variables? Should it stay there no matter what? If so, you need to account for that in your subsetting logic, as well.

1 Like