Skip to contents

Mutate new columns into sample_info

Usage

mutate2sample(
  object,
  what = c("mean_intensity", "median_intensity", "sum_intensity", "na_number", "na_prop"),
  according_to_variables = "all",
  ...
)

# S3 method for class 'microbiome_dataset'
mutate2sample(
  object,
  what = c("sum_intensity", "mean_intensity", "median_intensity", "na_number", "na_prop"),
  according_to_variables = "all",
  ...
)

Arguments

object

microbiome_dataset

what

which you want to mutate

according_to_variables

(required) What variables used to calculate. Default is "all". If you want to use only several variables, provide their names as a vector.

...

other params

Value

microbiome_dataset or data.frame.

Examples

data("global_patterns", package = "microbiomedataset")

x <- mutate2sample(global_patterns, what = "sum_intensity")
head(x@sample_info)
#>         sample_id  Primer Final_Barcode Barcode_truncated_plus_T
#> CL3           CL3 ILBC_01        AACGCA                   TGCGTT
#> CC1           CC1 ILBC_02        AACTCG                   CGAGTT
#> SV1           SV1 ILBC_03        AACTGT                   ACAGTT
#> M31Fcsw   M31Fcsw ILBC_04        AAGAGA                   TCTCTT
#> M11Fcsw   M11Fcsw ILBC_05        AAGCTG                   CAGCTT
#> M31Plmr   M31Plmr ILBC_07        AATCGT                   ACGATT
#>         Barcode_full_length SampleType
#> CL3             CTAGCGTGCGT       Soil
#> CC1             CATCGACGAGT       Soil
#> SV1             GTACGCACAGT       Soil
#> M31Fcsw         TCGACATCTCT      Feces
#> M11Fcsw         CGACTGCAGCT      Feces
#> M31Plmr         CGAGTCACGAT       Skin
#>                                        Description   class sum_intensity
#> CL3       Calhoun South Carolina Pine soil, pH 4.9 Subject        864077
#> CC1       Cedar Creek Minnesota, grassland, pH 6.1 Subject       1135457
#> SV1     Sevilleta new Mexico, desert scrub, pH 8.3 Subject        697509
#> M31Fcsw    M3, Day 1, fecal swab, whole body study Subject       1543451
#> M11Fcsw   M1, Day 1, fecal swab, whole body study  Subject       2076476
#> M31Plmr    M3, Day 1, right palm, whole body study Subject        718943