Skip to contents

selects the focus gas and checks the columns needed for the fluxible workflow

Usage

licoread_to_fluxible(
  df,
  focus_gas,
  datetime_col,
  id_cols = c("File Name", "Obs#"),
  file_type = "auto",
  file_type_list = c("82z", "81x", "auto")
)

Arguments

df

input dataframe from licoread

focus_gas

gas to select

datetime_col

column containing datetime information if date and time are in two different columns, provide a character vector of the form c("time", "date")

id_cols

columns to identify unique fluxes

file_type

type of file (82z or 81x). If "auto" (default), the function will try to detect it by itself.

file_type_list

list of file types

Value

an unnested df with only the selected gas

Examples

path_81x <- system.file("extdata/81x", package = "licoread")
gas_df_81x <- licoread(path_81x)
licoread_to_fluxible(gas_df_81x, "CO2", datetime_col = "Date")
#> # A tibble: 2,681 × 79
#>    f_fluxid f_datetime          f_conc f_start             f_end              
#>       <int> <dttm>               <dbl> <dttm>              <dttm>             
#>  1        1 2011-10-28 13:37:49   403. 2011-10-28 13:37:49 2011-10-28 13:39:32
#>  2        1 2011-10-28 13:37:50   403. 2011-10-28 13:37:49 2011-10-28 13:39:32
#>  3        1 2011-10-28 13:37:51   403. 2011-10-28 13:37:49 2011-10-28 13:39:32
#>  4        1 2011-10-28 13:37:52   403. 2011-10-28 13:37:49 2011-10-28 13:39:32
#>  5        1 2011-10-28 13:37:53   403. 2011-10-28 13:37:49 2011-10-28 13:39:32
#>  6        1 2011-10-28 13:37:54   404. 2011-10-28 13:37:49 2011-10-28 13:39:32
#>  7        1 2011-10-28 13:37:55   403. 2011-10-28 13:37:49 2011-10-28 13:39:32
#>  8        1 2011-10-28 13:37:56   403. 2011-10-28 13:37:49 2011-10-28 13:39:32
#>  9        1 2011-10-28 13:37:57   403. 2011-10-28 13:37:49 2011-10-28 13:39:32
#> 10        1 2011-10-28 13:37:58   403. 2011-10-28 13:37:49 2011-10-28 13:39:32
#> # ℹ 2,671 more rows
#> # ℹ 74 more variables: `LI-8100` <chr>, `File Name` <chr>,
#> #   `Instrument Name` <chr>, `Serial Number` <chr>, Software <chr>,
#> #   Comments <lgl>, `Obs#` <int>, `Port#` <int>, Label <chr>,
#> #   `Observation Length` <chr>, `Pre-purge` <chr>, `Post-purge` <chr>,
#> #   `IRGA Averaging` <int>, Chamber <int>, TSource <chr>, Flow8100 <int>,
#> #   Virga <dbl>, Vext <dbl>, Vcham <dbl>, Offset <dbl>, Area <dbl>, …
path_82z <- system.file("extdata/82z", package = "licoread")
gas_df_82z <- licoread(path_82z)
licoread_to_fluxible(gas_df_82z, "LI-7810_CH4_DRY",
datetime_col = c("LI-8250_DATE", "LI-8250_TIME"))
#> # A tibble: 394 × 125
#>    f_fluxid   f_datetime          f_conc f_start             f_end              
#>    <chr>      <dttm>               <dbl> <dttm>              <dttm>             
#>  1 82m-0109-… 2024-07-25 00:00:58  3002. 2024-07-25 00:00:58 2024-07-25 00:03:08
#>  2 82m-0109-… 2024-07-25 00:00:59  3002. 2024-07-25 00:00:58 2024-07-25 00:03:08
#>  3 82m-0109-… 2024-07-25 00:01:00  3002. 2024-07-25 00:00:58 2024-07-25 00:03:08
#>  4 82m-0109-… 2024-07-25 00:01:01  3002. 2024-07-25 00:00:58 2024-07-25 00:03:08
#>  5 82m-0109-… 2024-07-25 00:01:02  3002. 2024-07-25 00:00:58 2024-07-25 00:03:08
#>  6 82m-0109-… 2024-07-25 00:01:03  3003. 2024-07-25 00:00:58 2024-07-25 00:03:08
#>  7 82m-0109-… 2024-07-25 00:01:04  3003. 2024-07-25 00:00:58 2024-07-25 00:03:08
#>  8 82m-0109-… 2024-07-25 00:01:05  3003. 2024-07-25 00:00:58 2024-07-25 00:03:08
#>  9 82m-0109-… 2024-07-25 00:01:06  3004. 2024-07-25 00:00:58 2024-07-25 00:03:08
#> 10 82m-0109-… 2024-07-25 00:01:07  3005. 2024-07-25 00:00:58 2024-07-25 00:03:08
#> # ℹ 384 more rows
#> # ℹ 120 more variables: `LI-8250_T_CASE` <dbl>, `LI-8250_PA` <dbl>,
#> #   `LI-8250_T_PA` <dbl>, `LI-8250_PUMP_POSITIVE_PRESSURE` <dbl>,
#> #   `LI-8250_PUMP_NEGATIVE_PRESSURE` <dbl>, `LI-8250_FLOW` <dbl>,
#> #   `LI-8250_PUMP_TIME` <dbl>, `LI-8250_PUMP_SETPOINT` <dbl>,
#> #   `LI-8250_PUMP_CURRENT` <dbl>, `LI-8250_SUB_PRESSURE` <dbl>,
#> #   `LI-8250_SUB_FLOW` <dbl>, `LI-8250_VSO_FLOW_SETPOINT` <dbl>, …