rbind_score_list: Combine multiple exSTRa data objects.

Description Usage Arguments Value See Also Examples

View source: R/rbind_score_list.R

Description

Allows data from multiple exstra_score objects to be combined, similarly to rbindlist (data.table) and rbind. The exstra_score objects may either be given directly to rbind_score, or as a list to rbind_score_list that is easier to use when the number of objects to combine is not known in advance.

Usage

1
2
3
4
5
rbind_score_list(strscore_list, idcol = "data_group",
  allow_sample_clash = FALSE, fill = FALSE)

rbind_score(..., idcol = "data_group", allow_sample_clash = FALSE,
  fill = FALSE)

Arguments

strscore_list

A list containing exstra_score objects.

idcol

The name of the column giving the names of strscore_list in the output.

allow_sample_clash

If TRUE, allows a sample name to occur multiple times in the exstra_score objects, otherwise duplicates cause an error.

fill

If TRUE, missing columns are filled with NAs. Default FALSE.

...

exstra_score objects to combine.

Value

An exstra_score object.

See Also

rbindlist, rbind

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# create a list of distinct samples
score_list <- list(group1 = exstra_wgs_pcr_2[, "WGSrpt_20"], 
                   controls = exstra_wgs_pcr_2[, c("WGSrpt_02", "WGSrpt_04")],
                   group2 = exstra_wgs_pcr_2[, c("WGSrpt_15", "WGSrpt_16")]
                  )
combined_scores <- rbind_score_list(score_list)
combined_scores$samples

# Without using a list:
rbind_score(group1 = exstra_wgs_pcr_2[, "WGSrpt_20"], 
            controls = exstra_wgs_pcr_2[, c("WGSrpt_02", "WGSrpt_04")],
            group2 = exstra_wgs_pcr_2[, c("WGSrpt_15", "WGSrpt_16")]
            )$samples

# Combining with a repeated sample name, possibly due to multiple experiments.
# Splitting data for this example:
score_1 <- exstra_wgs_pcr_2["DM1", "WGSrpt_15"]
score_2 <- exstra_wgs_pcr_2["HD", "WGSrpt_15"]
# Combine with the sample name repeated across exstra_score objects:
rbind_score_list(list(score_1, score_2), allow_sample_clash = TRUE)
# or
rbind_score(score_1, score_2, allow_sample_clash = TRUE)

bahlolab/exSTRa documentation built on Jan. 24, 2018, 7:05 a.m.