How can I change the values of B by inputting different values for A with an R Shiny dashboard? The output I would like to get is a different dataframe with the updated values, that I can use for visualizations purposes.
test <- as.data.frame(matrix(c(3,6,7), ncol = 1))
colnames(test) <- "A"
test <- test %>% mutate(B = 2*A,
C = 3*B)
I would like to have a R Shiny dashboard that allows me to manually change the values of A and then updates the 'test' df so that the values of B and C are a result of the new values of A.
Can anyone help?
Try this in your shiny dashboard (server section)
test <- reactive({ test %>% mutate(B=2*A, C=3*B) })
You can access the new columns B
and C
in the dataframe
test()
and it gets updated every time you change A
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.