argo_pivot_longer: Transform Argo data to variable-long format

Description Usage Arguments Value Examples

View source: R/argo-pivot.R

Description

Whereas the variable-wide format returned by most Argo read and load functions are useful, some processing and plotting algorithms need data in a variable-long form, where the variable name is assigned to a column whose value is used to identify the measurement represented by each row.

Usage

1
argo_pivot_longer(tbl, id_cols)

Arguments

tbl

An Argo table with paired value/qc/adjusted columns, likely from argo_prof_levels() or argo_traj_measurement().

id_cols

A vector of column names used to identify each row in the output using dplyr::select() syntax.

Value

A tibble::tibble() with columns id_cols, variable, value, value_qc, value_adjusted, value_adjusted_qc, and value_adjusted_error.

Examples

1
2
3
4
5
6
library(dplyr, warn.conflicts = FALSE)

with_argo_example_cache({
  argo_prof_levels("dac/csio/2902746/profiles/BR2902746_001.nc") %>%
    argo_pivot_longer(id_cols = c(file, n_prof, pres))
})

ArgoCanada/argodata documentation built on Dec. 13, 2021, 10:13 a.m.