base_subset2: get a subset of a data frame

Description Usage Arguments Author(s) Examples

Description

subset2() can get a subset of a data frame,and keep data frame style regardless of the nrow or ncol of this subset.

Usage

1
2
3

Arguments

data

a data frame

colnames

the colnames vector of a subset

rownames

the rownames vector of a subset

Author(s)

Weibin Huang<654751191@qq.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## example
data <- data.frame(a=1:10,b=11:20,c=21:30,
                   row.names = paste("A",0:9,sep = ""))
subset2(data)

c = c("a","b");r=c("A0","A1","A2")
subset2(data,c,r)

c = c("a");r=c("A0","A1","A2")
subset2(data,c,r)

c = c("a","b");r=c("A0")
subset2(data,c,r)

c = c("a");r=c("A0")
subset2(data,c,r)

shijianasdf/BasicBioinformaticsAnalysisFromZhongShan documentation built on Jan. 3, 2020, 10:08 p.m.