Chapter 11 Bookmarking

This chapter is in development...

Exercise 11.3.1

Generate app for visualising the results of noise::ambient_simplex(). Your app should allow the user to control the frequency, fractal, lacunarity, and gain, and be bookmarkable. How can you ensure the image looks exactly the same when reloaded from the bookmark? (Think about what the seed argument implies).

Exercise 11.3.2

Make a simple app that lets you upload a csv file and then bookmark it. Upload a few files and then look in shiny_bookmarks. How do the files correspond to the bookmarks? (Hint: you can use readRDS() to look inside the cache files that Shiny is generating).

Solution. Solution

By setting the state$values$data equal to the data reactive, we can store the contents of the uploaded csv. Looking in the shiny_bookmarks folder we see an input.rds which has the same 4 arguments as input$file:

  1. name
  2. size
  3. type
  4. datapath

All of these except the datapath are the same as when we upload the file; rather than the temporary location the file is saved to within the shiny session, the datapath becomes 0.csv, a csv file created within the same folder are our input.RDS.