strsplit2: Split Composite Names

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/read.R

Description

Split a vector of composite names into a matrix of simple names.

Usage

1

Arguments

x

character vector

split

character to split each element of vector on, see strsplit

...

other arguments are passed to strsplit

Details

This function is the same as strsplit except that the output value is a matrix instead of a list. The first column of the matrix contains the first component from each element of x, the second column contains the second components etc. The number of columns is equal to the maximum number of components for any element of x.

The motivation for this function in the limma package is handle input columns which are composites of two or more annotation fields.

Value

A list containing components

Name

character vector of the same length as x contain first splits of each element

Annotation

character vector of the same length as x contain second splits of each element

Author(s)

Gordon Smyth

See Also

strsplit.

An overview of LIMMA functions for reading data is given in 03.ReadingData.

Examples

1
2
3
4
x <- c("AA196000;actinin, alpha 3",
"AA464163;acyl-Coenzyme A dehydrogenase, very long chain",
"3E7;W15277;No Annotation")
strsplit2(x,split=";")

Example output

     [,1]       [,2]                                            
[1,] "AA196000" "actinin, alpha 3"                              
[2,] "AA464163" "acyl-Coenzyme A dehydrogenase, very long chain"
[3,] "3E7"      "W15277"                                        
     [,3]           
[1,] ""             
[2,] ""             
[3,] "No Annotation"

limma documentation built on Nov. 8, 2020, 8:28 p.m.