R/readNULISAseq.R
renameSC.RdThis function renames instances of "SC" and "AQSC" in the input column by appending a counter to each occurrence. The counter cycles through values from 1 to `n`, and resets back to 1 after reaching the specified limit.
renameSC(column, label = "SC", label2 = "AQSC", n = 3)A character vector or column of values to be renamed. It should contain "SC" and "AQSC" values that need to be renamed.
A string specifying the first label to be renamed (default is "SC").
A string specifying the second label to be renamed (default is "AQSC").
An integer specifying the maximum value for the counter. The counter cycles from 1 to `n` for each label occurrence (default is 3).
A character vector with the renamed values. The labels "SC" and "AQSC" will have a counter appended to them (e.g., "SC_1", "AQSC_1", etc.), while other values will remain unchanged.
The function works by iterating over the input vector and checking each value. If the value is equal to `label` or `label2`, a counter is appended to it. The counter resets to 1 after reaching the value `n`. This is useful for ensuring unique naming of standard controls and assay quality standard controls in a dataset.
# Example usage:
renameSC(c("SC", "AQSC", "SC", "Other", "AQSC"))
#> Error in renameSC(c("SC", "AQSC", "SC", "Other", "AQSC")): could not find function "renameSC"
renameSC(c("SC", "AQSC", "SC", "Other", "AQSC"), n = 2)
#> Error in renameSC(c("SC", "AQSC", "SC", "Other", "AQSC"), n = 2): could not find function "renameSC"