View source: R/pacea-wrangle.R
pacea_long | R Documentation |
Simplified function for users, taking the ‘tidyr::pivot_longer' and 'tidyr::pivot_wider' functions to transform pacea.st data into long or wide format for simpler data manipulation, summarising, and plotting. Writted to only work with ’pacea.st' (spatiotemporal) data.
pacea_long(data, names_to = "date", values_to = "value")
pacea_wide(data, names_from = c("year", "month"), values_from = "value")
data |
pacea.st data object in long format to pivot. |
names_to |
A character value for the column name representing the date. Defaults to separate 'year' and 'month' for BCCM data. |
values_to |
A character value for the column name representing variable data (e.g. temperature) |
names_from |
A character vector representing the date from which to name columns from. If vector is greater than 1, column values will be pasted together, separated by '_'. Defaults to paste BCCM data in 'year_month' format. |
values_from |
A character value representing the column names from which to get variable data values. |
pacea spatiotemporal data in long/wide format
## Not run:
pdata <- bccm_surface_temperature()[,1:2]
pdata_long <- pacea_long(pdata)
head(pdata_long)
## End(Not run)
## Not run:
pdata <- bccm_surface_temperature()[,1:2]
pdata_long <- pacea_long(pdata)
pdata_wide <- pacea_wide(pdata)
head(pdata_wide)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.