Learn R Programming

vcfR (version 1.4.0)

masplit: masplit

Description

Split a matrix of delimited strings.

Usage

masplit(myMat, delim = ",", count = 0L, record = 1L, sort = 1L,
  decreasing = 1L)

Arguments

myMat

a matrix of delimited strings (e.g., "7,2").

delim

character that delimits values.

count

return the count of delimited records.

record

which (1-based) record to return.

sort

should the records be sorted prior to selecting the element?

decreasing

should the values be sorted decreasing (1) or increasing (0)?

Value

A numeric matrix of numerics

Details

Split a matrix of delimited strings.

Examples

Run this code
# NOT RUN {
set.seed(999)
x1 <- round(rnorm(n=9, mean=10, sd=2))
x2 <- round(rnorm(n=9, mean=20, sd=2))
ad <- matrix(paste(x1, x2, sep=","), nrow=3, ncol=3)
colnames(ad) <- paste('Sample', 1:3, sep="_")
rownames(ad) <- paste('Variant', 1:3, sep="_")
ad[1,1] <- "9,23,12"
is.na(ad[3,1]) <- TRUE

ad
masplit(ad, count = 1)
masplit(ad, sort = 0)
masplit(ad, sort = 0, record = 2)
masplit(ad, sort = 0, record = 3)
masplit(ad, sort = 1, decreasing = 0)


# }

Run the code above in your browser using DataLab