pathos
1
This works perfectly fine:
df |> mutate(abc = get(input$abc))
where input$abc
is user selected column from df
.
These do not:
df |> rename(abc = get(input$abc))
df |> select(-get(input$abc))
Why doesn't this work?
Solution (don't use get()):
df |> rename(abc = input$abc)
It might be an accident. Do you have a variable in your global namespace that is a vector named the same as the content of the input?
What was your intent behind trying to use get()? How is it relevant for your task...
pathos
3
Do you have a variable in your global namespace that is a vector named the same as the content of the input?
No, it's cleared out (beforehand).
What was your intent behind trying to use get()? How is it relevant for your task...
In Shiny dashboard, I have to use get()
in order to correctly call the columns within the df
, which is a user-uploaded data.
df <- iris
input <- list()
input$abc <-"Sepal.Length"
#rather than this
df %>% mutate(abc = get(input$abc))
#do this
df %>% mutate(abc = !!sym(input$abc))
1 Like
system
Closed
5
This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.