Many Argo tables have _adjusted columns that contain a more reliable value.
However, in many cases, these values are blank or not present. Use
argo_use_adjusted() to replace NA values in cols with the value in
the paired _adjusted column. You can use this with
argo_qc_censor_if_not() to set values in cols to NA based on the paired
_qc column prior to preferring the adjusted value.
argo_use_adjusted(
tbl,
cols,
adjusted_cols = argo_adjusted_cols(tbl, { { cols } })
)
argo_adjusted_cols(tbl, cols)tbl A data frame containing _adjusted or _ADJUSTED columns.
Columns in tbl, specified using dplyr::select() syntax.
A paired vector of columns to cols containing the
adjusted value to prefer over the value in cols.
A tibble::tibble() with
library(dplyr, warn.conflicts = FALSE)
with_argo_example_cache({
argo_prof_levels("dac/csio/2902746/profiles/BR2902746_001.nc") %>%
argo_use_adjusted(doxy)
})
#> Extracting from 1 file
#> # A tibble: 101 × 15
#> file n_levels n_prof pres c1phase_doxy c1phase_doxy_qc c2phase_doxy
#> <chr> <int> <int> <dbl> <dbl> <chr> <dbl>
#> 1 csio/2902746… 1 1 0.200 35.3 0 5.62
#> 2 csio/2902746… 2 1 0.900 35.4 0 5.61
#> 3 csio/2902746… 3 1 1.90 35.5 0 5.60
#> 4 csio/2902746… 4 1 2.90 35.6 0 5.60
#> 5 csio/2902746… 5 1 4 35.6 0 5.59
#> 6 csio/2902746… 6 1 5 35.6 0 5.59
#> 7 csio/2902746… 7 1 6 35.6 0 5.59
#> 8 csio/2902746… 8 1 7.10 35.6 0 5.58
#> 9 csio/2902746… 9 1 8.20 35.6 0 5.58
#> 10 csio/2902746… 10 1 9.30 35.6 0 5.58
#> # … with 91 more rows, and 8 more variables: c2phase_doxy_qc <chr>,
#> # temp_doxy <dbl>, temp_doxy_qc <chr>, doxy <dbl>, doxy_qc <chr>,
#> # doxy_adjusted <dbl>, doxy_adjusted_qc <chr>, doxy_adjusted_error <dbl>