Learn R Programming

photobiology (version 0.11.3)

make_var_labels: Column or variable labels

Description

Create a named list of character strings describing the variables contained in a spectrum object.

Usage

make_var_labels(x, ...)

# S3 method for default make_var_labels(x, ...)

# S3 method for source_spct make_var_labels(x, ...)

# S3 method for response_spct make_var_labels(x, ...)

# S3 method for filter_spct make_var_labels(x, ...)

# S3 method for reflector_spct make_var_labels(x, ...)

# S3 method for object_spct make_var_labels(x, ...)

# S3 method for solute_spct make_var_labels(x, ...)

# S3 method for chroma_spct make_var_labels(x, ...)

# S3 method for calibration_spct make_var_labels(x, ...)

# S3 method for raw_spct make_var_labels(x, ...)

# S3 method for cps_spct make_var_labels(x, ...)

Value

A named list of character strings with one member for each recognized column in x. This list can be used to set variable labels with methods from package 'labelled'. However, package 'photobiology' does not natively support variable labels stored in attribute label.

Arguments

x

An object of a class derived from generic_spct.

...

Currently ignored.

Methods (by class)

  • make_var_labels(default):

  • make_var_labels(source_spct):

  • make_var_labels(response_spct):

  • make_var_labels(filter_spct):

  • make_var_labels(reflector_spct):

  • make_var_labels(object_spct):

  • make_var_labels(solute_spct):

  • make_var_labels(chroma_spct):

  • make_var_labels(calibration_spct):

  • make_var_labels(raw_spct):

  • make_var_labels(cps_spct):

Details

Objects of classes derived from generic_spct are used to store different types of spectral data. The data stored in some of the classes needs to be interpreted differently depending on how they were measured or are expressed and this information is stored in attributes of the objects. In other cases, even if consistent across different objects, the units of expression may not be obvious to users. The names of the variables are concise, thus using variable labels makes it possible to make these features visible when exploring the data. The methods provided do not add the labels, only supply the character strings. Variable labels are implemented in packages 'labelled' by setting the label attribute in each variable (= column) of a data frame or tibble. This is compatible with the approach used by package 'haven'.

Examples

Run this code
make_var_labels(sun.spct)
# str() prints more compactly than print()
str(make_var_labels(sun.spct))
str(make_var_labels(normalize(sun.spct)))
str(make_var_labels(fscale(sun.spct)))

str(make_var_labels(sun_daily.spct))

str(make_var_labels(polyester.spct))
str(make_var_labels(normalize(polyester.spct)))
str(make_var_labels(fscale(polyester.spct)))

str(make_var_labels(white_led.cps_spct))
str(make_var_labels(white_led.raw_spct))

Run the code above in your browser using DataLab