
reassign the sample info
reassign.Rdreassign() 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  CVs
#>      ct     7055    66329           58706        0.908 0.16
#>      kd     7055    66329           58706        0.909 0.21
#> 
# reassign specific file_ids
hela_proteins %>%
   reassign(sample_file == "f1", .replace = "new") %>%
   reassign(sample_file == "f2", .replace = "new") %>%
   summary("sample")
#> Error in reassign(., sample_file == "f1", .replace = "new"): did not find f1 in sample_file