reassign() enables editing of the sample descriptive in the experimental table.
This function will only replace the sample string and update the replicate number.
Arguments
- data
a tidyproteomics data-object
- ...
a three part expression (eg. x == a)
- .replace
a character string
Examples
library(dplyr, warn.conflicts = FALSE)
library(tidyproteomics)
# check the experiment table
hela_proteins %>% summary("experiment")
#>
#> ── Summary: experiment ──
#>
#> sample_id import_file sample_file sample replicate
#> 9e6ed3ba p97KD_HCT116_proteins.xlsx F1 control 1
#> cc56fc1d p97KD_HCT116_proteins.xlsx F4 control 2
#> 6a21f7a9 p97KD_HCT116_proteins.xlsx F5 control 3
#> 966be57f p97KD_HCT116_proteins.xlsx F2 knockdown 1
#> 79a98e41 p97KD_HCT116_proteins.xlsx F3 knockdown 2
#> 9f804505 p97KD_HCT116_proteins.xlsx F6 knockdown 3
#>
# make the modification
hela_proteins %>%
reassign(sample == "control", .replace = "ct") %>%
reassign(sample == "knockdown", .replace = "kd") %>%
summary("sample")
#> ℹ Reassigning 1, 2, and 3
#> ℹ Reassigning 4, 5, and 6
#>
#> ── Summary: sample ──
#>
#> sample proteins peptides peptides_unique quantifiable CV PC1 PC2
#> ct 7055 66329 58706 0.908 0.16 0.56 0.44
#> kd 7055 66329 58706 0.909 0.21 0.72 0.28
#>
# reassign specific file_ids
hela_proteins %>%
reassign(sample_file == "F1", .replace = "new") %>%
reassign(sample_file == "F2", .replace = "new") %>%
summary("sample")
#> ℹ Reassigning 1
#> ℹ Reassigning 4
#>
#> ── Summary: sample ──
#>
#> sample proteins peptides peptides_unique quantifiable CV PC1 PC2
#> control 7055 66329 58706 0.908 0.14 1 0
#> knockdown 7055 66329 58706 0.908 0.24 1 0
#> new 7055 66329 58706 0.908 0.21 1 0
#>
