Group input ir
objects by rows
Arguments
- .data
Input data frame.
- ...
<
tidy-select
> Variables to be preserved when callingsummarise()
. This is typically a set of variables whose combination uniquely identify each row.NB: unlike
group_by()
you can not create new variables here but instead you can select multiple variables with (e.g.)everything()
.- data
An object of class
ir
.
Value
data
as row-wise data frame. See dplyr::rowwise()
.
See also
Other tidyverse:
arrange.ir()
,
distinct.ir()
,
extract.ir()
,
filter-joins
,
filter.ir()
,
group_by
,
mutate-joins
,
mutate
,
nest
,
pivot_longer.ir()
,
pivot_wider.ir()
,
rename
,
select.ir()
,
separate.ir()
,
separate_rows.ir()
,
slice
,
summarize
,
unite.ir()
Examples
## rowwise
dplyr::rowwise(ir_sample_data) %>%
dplyr::mutate(
hkl =
mean(
units::drop_units(klason_lignin),
units::drop_units(holocellulose)
)
)
#> # A tibble: 58 × 8
#> # Rowwise:
#> id_measurement id_sample sample_type sample_comment klason_lignin
#> * <int> <chr> <chr> <chr> [1]
#> 1 1 GN 11-389 needles Abies Firma Momi fir 0.360
#> 2 2 GN 11-400 needles Cupressocyparis leylandii… 0.339
#> 3 3 GN 11-407 needles Juniperus chinensis Chine… 0.268
#> 4 4 GN 11-411 needles Metasequoia glyptostroboi… 0.350
#> 5 5 GN 11-416 needles Pinus strobus Torulosa 0.331
#> 6 6 GN 11-419 needles Pseudolarix amabili Golde… 0.279
#> 7 7 GN 11-422 needles Sequoia sempervirens Cali… 0.330
#> 8 8 GN 11-423 needles Taxodium distichum Cascad… 0.357
#> 9 9 GN 11-428 needles Thuja occidentalis Easter… 0.369
#> 10 10 GN 11-434 needles Tsuga caroliniana Carolin… 0.289
#> # … with 48 more rows, and 3 more variables: holocellulose [1],
#> # spectra <named list>, hkl <dbl>