Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. years <- c(2017,2018,2019,2017,2017,2018,2018,2019)
  2. obs <- c("a","b","c","d","e","f","g","h")
  3. df <- data.frame(years,obs)
  4.  
  5. anos <- unique(df$years)
  6.  
  7. for (val in anos){
  8. assign(paste0("df_",val), filter(df, years == val))
  9. }
  10.  
  11. library(shiny)
  12.  
  13. years <- c(2017,2018,2019,2017,2017,2018,2018,2019)
  14. obs <- c("a","b","c","d","e","f","g","h")
  15. df <- data.frame(years,obs)
  16.  
  17. ui <- fluidPage(
  18. sidebarPanel(
  19. radioButtons("year","year",choices=c(2017,2018,2019)),
  20. pickerInput("valor","valor",choices=obs,selected=obs,multiple=TRUE)
  21. ),
  22. mainPanel(
  23. htmlOutput("result")
  24. )
  25. )
  26.  
  27. server <- function(input,output,session){
  28. df_val <- reactive({
  29. filter(df, obs %in% input$valor)
  30. })
  31.  
  32. anos <- reactive(unique(df_val()$years))
  33.  
  34. for (val in anos){
  35. assign(paste0("df_",val),filter(df_val(), years == val))
  36. }
  37. }
  38.  
  39. shinyApp(ui=ui,server=server)
  40.  
  41. Error in server(...) :
  42. long vectors not supported yet: ../../../../R-3.5.3/src/main/eval.c:2204
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement