For internal & external contributors to the tutorials. Please add anything to this document you find helpful.
See template tutorial which sets out standard format, you can copy & paste this to start a new tutorial.
Pull requests welcome from anyone. Internal contributors are encouraged to push text changes directly (you don't need to submit pull requests). To minimise potential for conflicts remember to pull before making changes and communicate with others about what you are working on.
- usethis::use_tutorial("[short-name]", "[Tutorial title]") # this will create a new folder in inst/tutorials, with a new .Rmd file in
- copy & paste content of the template tutorial into the new .Rmd file to start
- headers indicated with '##' become separate sections and appear in index on left
See these guidelines for deploying learnr tutorials on shinyapps. Particularly note increasing number of instances to the maximum from the Overview page using the + icon (5 in our case), and increase instance size to maximum. I also decreased max worker processes from 3 to 2.
- exercise chunks plotting interactive maps (with tmap or mapview) need to have unique ids set like this :
# to avoid issues with interactive maps https://github.com/rstudio/learnr/issues/529
# IdSeed must be set to be unique in the Rmd, even for mode('plot') to allow user to change
tmap_mode("plot")
htmlwidgets::setWidgetIdSeed(1)
-
2021-01 join-admin previously uploading to shinyapps gave this error Error in value[3L] : there is no package called 'sf' turned out to be an issue with the fill-the-blanks sections lower down updating to dev version of packrat locally fixed deployment remotes::install_github('rstudio/packrat') see #4 (comment)
-
2020 intro-to-spatial error on deploying to shinyapps Error in value[3L] :OGRCreateCoordinateTransformation() returned NULL: PROJ available? https://stackoverflow.com/questions/61286108/error-in-cpl-transformx-crs-aoi-pipeline-reverse-ogrcreatecoordinatetrans If you save an sf-dataframe with a newer version of GDAL, and then try on a system with an older version of GDAL, the projection info cannot be read properly. The solution is to re-set the projection: st_crs(data) <- 4326
-
when deploying to shinyapps can get an error like this :
Package 'afrilearndata 0.0.0.9003' was installed from sources; Packrat will assume this package is available from a CRAN-like repository during future restores. Caused if a package (afrilearndata in this case) has been built locally. SOlution is to reinstall from Github : remotes::install_github("afrimapr/afrilearndata")