Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

packageData

Loading Package Data


Description

Loads package data using data, but allows the user to avoid NOTEs for a ‘non visible binding variable’ to be thrown when checking a package. This is possible because this function returns the loaded data.

Usage

packageData(
  list,
  envir = .GlobalEnv,
  ...,
  options = NULL,
  stringsAsFactors = getOption("stringsAsFactors")
)

ldata(list, ..., package = NULL, error = TRUE, simplify = TRUE)

Arguments

list

character vector containing the names of the data to load.

envir

the environment where the data should be loaded.

...

other arguments eventually passed to data.

options

list of R options to set before calling data. This may be useful the data is shipped as an R script.

stringsAsFactors

logical that indicates if character columns of tabular data should be converted into factors.

package

a character vector giving the package(s) to look in for data sets, or NULL.

By default, all packages in the search path are used, then the ‘data’ subdirectory (if present) of the current working directory.

error

a logical that indicates whether an error should be thrown if the requested data cannot be found.

simplify

logical that indicates if queries of one object only (i.e. argument list is of length one) should return the data object itself.

Value

the loaded data.

Functions

  • ldata: loads a package data in the parent frame. It is a shortcut for packageData(list, ..., envir=parent.frame()).

Examples

## Not run:  mydata <- packageData('mydata') 


## Not run:  
# in a package' source => won't issue a NOTE
myfunction function(){
	mydata <- ldata('mydata') 
}

## End(Not run)

pkgmaker

Development Utilities for R Packages

v0.32.2
GPL (>= 2)
Authors
Renaud Gaujoux [aut, cre]
Initial release
2020-10-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.