Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R calling a dataset in the package itself

I have created a package containing a dataset called mydata.

I want to use my dataset in my functions but I dont know how to call it. when i use data("mydata") to call my dataset and avoid warning messages I have another message during the building process

See section ‘Good practice’ in ‘?data’.

@imporFrom mypackage mydata doesn't work either. What's the best way to call a dataset in the package itself?

like image 899
thierry cnam Avatar asked Sep 24 '19 13:09

thierry cnam


1 Answers

Use package_name::mydata, example in car package car::Angell.

Dataset is in a data folder with for example mydata.rda inside.

To add help, create a data.R file in R folder.

Personnaly I put inside :

# 1. mydata ----

#' Here is a long title
#'
#' Description of the dataset : length, columns
#'
#' @format one object of class XXX
#'
#' @source where it comes from
#' @name mydata
NULL
like image 174
Clemsang Avatar answered Oct 18 '22 20:10

Clemsang