0

Is it possible to remove one item from $race_ethnicity array below. The choices argument returns Asian, African-American, American Indian, Filipino, Hispanic, Pacific Islander, White, and Not Reported.

Is there a way of removing Not Reported from the first code option, or is the only solution to list out the other 7 choices as in the second code option?

raw_df_filter <- raw_df
      updateSelectInput(inputId = "race",
                        choices = c(not_sel, unique(sort(raw_df_filter$race_ethnicity))))


raw_df_filter <- raw_df
      updateSelectInput(inputId = "race",
                        choices = c(not_sel, "Asian", "African-American", "American Indian", "Filipino", "Hispanic", "Pacific Islander", "White"))))
Shannon
  • 125
  • 7
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Aug 14 '23 at 19:28

1 Answers1

0
raw_df_filter <- raw_df

# Filter out "Not Reported" from the choices
filtered_choices <- setdiff(unique(raw_df_filter$race_ethnicity), "Not Reported")

# Update the select input with the filtered choices
updateSelectInput(inputId = "race",
                  choices = c(not_sel, filtered_choices))