Filter data in a pin from Rstudio connect

102 Views Asked by At

I have pinned a list of datasets on Rstudio connect. (there are about 100 datasets in the list) I am trying to create a shiny app that will use the datasets from the pin based on the user input.

Is it possible to pin_get part of the list ?

To add an example here is what I am trying to do

# Create board
board_register("rsconnect", 
                server = MY_SERVER,
                key = MY_KEY,)

# Create list of dataframes
dflist <- lapply(1:10, function(x) {mtcars})

# Pin dflist to your board
pin(dflist , "Pinned_dflist", board = "rsconnect")

#Get dflist back in another document 
dfs<- pin_get("Pinned_dflist", board = "rsconnect")

# Keep only needed dataframe in shiny

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      selectInput(
        inputId = "df_num",
        label = "Select dfnumber",
        choices = seq(1:10),
        multiple = FALSE
      )
    )
    mainPanel(
       plotOutput("plot")
    )
  )
server <- function(input, output, ...) {
    
    output$plot <- renderPlot({
      plot(dfs[[input$df_num]])
    })

     
0

There are 0 best solutions below