Description Usage Arguments Details Value Examples
to_long
transforms wide-formatted data, where each
column respresents an observation for a specific day for a specific site, to
wide-formatted data, where each row corresponds to an observation for a
single day for a specific site.
1 |
data |
wide format data |
keep_cols |
columns in |
date_sep |
character used to delimit variable prefix from date in column names; defaults to underscore ("_") |
to_long
assumes data
has a column indicating site
unique identifier (i.e. a site ID column) and remaining columns are daily
measurements of a variable in question (i.e rainfall, temperature).
Remaining column names are assumed to have a prefix, a separator character,
and date in YYYYMMDD format. For example, rainfall data column names would
be something like "rf_19830325". Character strings occuring before
delimiter are not used. The character string in column names corresponding
to date are used to extract the date (YYYYMMDD).
If to_long
encounters invalid dates (e.g. 30 February 1984), such
dates will be assigned a value of NA
in resultant data frame and a
warning will be thrown.
data frame where each row corresponds to an observation for a single
day. Measurements are in the column value
and date is in the column
date
. Measurements retain the class of original data, and date is of
class Date
.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.