fusen icon indicating copy to clipboard operation
fusen copied to clipboard

Help deal with dataset

Open statnmap opened this issue 4 years ago • 3 comments

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.

statnmap avatar Jan 27 '21 09:01 statnmap

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

statnmap avatar Jul 01 '21 10:07 statnmap

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 ?

tbesse-oeb avatar Feb 07 '22 11:02 tbesse-oeb

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.

statnmap avatar Mar 15 '22 20:03 statnmap

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

statnmap avatar Jun 02 '23 07:06 statnmap