Description Usage Arguments Value Author(s) Examples
Split data.frame given one leveled column
1 |
x |
data.frame |
which.col |
column index or name |
levels |
character see |
named list
Xiaobei Zhao
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | x <- read.table(textConnection("
chr1 0 100
chr2 100 200
chr10 200 300
"),col.names=c('chr','start','end'))
## compare the results by base::split and dfsplit
split(x,f=x[,'chr'])
## $chr1
## chr start end
## 1 chr1 0 100
## $chr10
## chr start end
## 3 chr10 200 300
## $chr2
## chr start end
## 2 chr2 100 200
dfsplit(x,'chr',c('chr1','chr2','chr10'))
## $chr1
## chr start end
## 1 chr1 0 100
## $chr2
## chr start end
## 2 chr2 100 200
## $chr10
## chr start end
## 3 chr10 200 300
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.