load_safe_data: Loads data from a SAFE dataset.

Description Usage Arguments Details Value Methods (by generic) Examples

View source: R/load_safe.R

Description

This function returns a data frame containing the data from a data worksheet in a SAFE dataset. Note that SAFE dataset .xlsx files include the other (non-data) worksheets Summary, Taxa, Locations that contain metadata: see get_taxa, get_locations, add_taxa and add_locations for accessing and using this metadata.

Usage

1
2
3
4
5
6
7
load_safe_data(record_id, worksheet)

## S3 method for class 'safedata'
str(object, ...)

## S3 method for class 'safedata'
print(x, n = 10, ...)

Arguments

record_id

A SAFE dataset record id

worksheet

The name of the worksheet to load

...

Further arguments to str and print methods.

x, object

A safedata object.

n

The number of rows to show in the print method.

Details

In particular, the large amount of data worksheet summary metadata is not attached as attributes to the data frame returned by this function. This is largely to avoid excessive output to the console during normal use of the data frame: an extended description of a worksheet can be displayed using show_worksheet.

Currently, this function only loads data from SAFE formatted .xlsx files - data stored in external files is not yet handled.

Value

A data frame with the additional safedata class and additional attribute data containing metadata for the data.

Methods (by generic)

Examples

1
2
3
4
5
6
   safedir <- system.file('example_data_dir', package='safedata')
   set_safe_dir(safedir, update=FALSE, validate=FALSE)
   beetle_abund <- load_safe_data(1400562, 'Ant-Psel')
   str(beetle_abund)
   # See also the show_worksheet function for further worksheet metadata
   show_worksheet(beetle_abund)

ImperialCollegeLondon/safe_data documentation built on Jan. 29, 2020, 10:19 p.m.