fusen
                                
                                 fusen copied to clipboard
                                
                                    fusen copied to clipboard
                            
                            
                            
                        Help deal with dataset
Use a chunk named data where you can read data as in a classical Rmd.
Detect path to dataset, copy it to inst and transform path as system.file() for examples and tests.
Detect named given to dataset object if use in examples and tests, to add data read in these parts too.
Make {fusen} work with documented datasets
#' mon jeu de données
#'
#' Un jeu de données contenant un bout d'iris
#'
#' @name mes_data_nettoyees
#' @docType data
#' @author Colin \email{colin@@thinkr.fr}
#' @source \url{google.com}{unlien}
#' @format data.frame
#' @keywords data
"mes_data_nettoyees"
Or
#' My included vector
#' # Not sure putting this in a separate chunk works properly with {fusen} ?
my_vector <- 1:12
I was just looking for this feature !
If I understand the "Tips and triks" page correctly, if I want to include a dataset in my package :
- I use a "development" chunk to write the script used to create the dataset (ending with usethis::use_data(substances_actives, overwrite = TRUE)to store it in data/)
- I use a "function" chunk to document the dataset
Will fusen create the .R file in data-raw with the creation script when inflating the package ?
No, but it is not needed.
What is written in the function chunk is copied as is in the "R/" directory => You can write here the necessary documentation of a dataset included in "data/" (as with usethis::use_data())
"data-raw/" is not necessary. It is not a mandatory directory for package development. Indeed, if you use usethis::use_data_raw(), the "data-raw/" directory is listed in the ".RBuildignore" file. This is exactly the same case for the "dev/" directory used for {fusen}. This is only a convenient separate place to store some code for developers during preparation of a package.
Hence, you need to choose where you store your dataset preparation script. In "dev/" or in "data-raw/", depending on your way of developing.
Because of {fusen} use, I would say that any Rmd script necessary for the preparation of our package, (data or function), can be stored in "dev/", so that developers know where to look for.
This issue is listed in the future roadmap. It will be re-opened when necessary. See: https://github.com/ThinkR-open/fusen/wiki/Future-road-map