Copy the when.measured, where.measured or what.measured attribute from members of a generic_mspct object into a tibble or data.frame.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
add_attr2tb(tb, mspct, col.names = NULL, idx = "spct.idx") when_measured2tb(mspct, tb = NULL, col.names = "when.measured", idx = "spct.idx") lonlat2tb(mspct, tb = NULL, col.names = c("lon", "lat"), idx = "spct.idx") lon2tb(mspct, tb = NULL, col.names = "lon", idx = "spct.idx") lat2tb(mspct, tb = NULL, col.names = "lat", idx = "spct.idx") geocode2tb(mspct, tb = NULL, col.names = "geocode", idx = "spct.idx") what_measured2tb(mspct, tb = NULL, col.names = "what.measured", idx = "spct.idx")
tibble or data.frame to which to add the data (optional).
generic_mspct Any collection of spectra.
named character vector Name(s) of column(s) to create. Values are the names of the attributes to copy, while if named, the names provide the name for the column.
character Name of the column with the names of the members of the collection of spectra.
The attributes are copied to a column in a tibble or data frame. If
tb formal parameter receives
NULL as argument, a new
tibble will be created. If an existing
tibble is passed as argument, new columns are added to it. However,
the number of rows in the argument passed to
tb must match the
number of spectra in the argument passed to
mspct. If the argument
col.names is aa named vector, with the names of members matching
the names of attributes, then the values are used as names for the columns
created. This permits setting any valid name for the new columns. If the
vector passed to
col.names has no names, then the values are
interpreted as the names of the attributes to add, and also used as names
for the new columns.
A tibble With the metadata attributes in separate new variables.
Currently supported attributes are
"where.measured". In the case of
"where.measured", which has different components the name
"where.measured" is ignored, but instead the following names are
"lat" for creating numeric columns of
longitudes and latitudes respectively, and
"geocode" for creating a
column of data frames, in which case, if
tb is not already a
tibble it is converted into one before adding the new column. The
order of the first two arguments is reversed in
compared to the other functions. This is to allow its use in 'pipes', while
the functions for single attributes are expected to be used mostly to
create new tibbles.
1 2 3 4 5 6 7 8 9
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.