![]() Re-load all code in the app with Cmd/Ctrl + Shift + L. Putting your app code into the package structure unlocks a new workflow: I can now delete birthstones.csv and remove the line that reads it in: stones <- vroom::vroom("birthstones.csv"). ![]() This creates data/stones.rda, which will be loaded automatically when I load the package. ) Īs an optional extra, I converted birthstones.csv to a package dataset by running usethis::use_data(stones). ![]() I’d suggested starting with R Packages to get the lay of the package development land, then continuing on to Engineering Shiny, by Colin Fay, Sébastien Rochette, Vincent Guyader, Cervan Girard, to learn more about the intersection of R packages and Shiny apps. In this chapter, I’ll show you the most important conventions, and then provide a few hints as to next steps.Īs you start working with app-packages, you may find that you enjoy the process of package development and want to learn more. The core idea of a package is that it’s a set of conventions for organising your code and related artefacts: if you follow those conventions, you get a bunch of tools for free. It’s easy to think of packages as giant complicated things like Shiny, ggplot2, or dplyr. In the long run, it also helps you document complex apps using roxygen2, although we won’t discuss that in this book. The package structure will pay off further when we talk about testing in Chapter 21, because you get tools that make it easy to run the tests and to see what code is tested. It’s a long way from a complete package, but it’s still useful because it activates new tools that make it easier to work with larger app. This structure gets your toes into the water of package development. Write a function that starts your app (i.e. calls shinyApp() with your UI and server).Ĭreate a DESCRIPTION file in the root directory of your app. If you are creating a large or long-term Shiny app, I highly recommend that you organise your app in the same way as an R package.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |