[R] strsplit help

alison waller alison.waller at embl.de
Wed Apr 11 15:23:29 CEST 2012


Dear all,

I want to use string split to parse column names, however, I am having 
some errors that I don't understand.
I see a problem when I try to rbind the output from strsplit.

please let me know if I'm missing something obvious,

thanks,
alison

here are my commands:
 >strsplit<-strsplit(as.character(Rumino_Reps_agreeWalign$geneid),"\\.")
 > 
Rumino_Reps_agreeWalignTR<-transform(Rumino_Reps_agreeWalign,taxid=do.call(rbind, 
strsplit))
Warning message:
In function (..., deparse.level = 1)  :
   number of columns of result is not a multiple of vector length (arg 1)


here is my data:

 > head(Rumino_Reps_agreeWalign)
                       geneid count_Conser count_NonCons count_ConsSubst
1 657313.locus_tag:RTO_08940            7             5               5
2           457412.251848018            1             4               3
3 657314.locus_tag:CK5_20630            2             4               1
4 657323.locus_tag:CK1_33060            1             0               1
5 657313.locus_tag:RTO_09690            3             0               3
6           471875.197297106            0             2               1
   count_NCSubst
1             1
2             0
3             0
4             0
5             1
6             1

here are the results from strsplit:
 > head(strsplit)
[[1]]
[1] "657313"              "locus_tag:RTO_08940"

[[2]]
[1] "457412"    "251848018"

[[3]]
[1] "657314"              "locus_tag:CK5_20630"

[[4]]
[1] "657323"              "locus_tag:CK1_33060"

[[5]]
[1] "657313"              "locus_tag:RTO_09690"

[[6]]
[1] "471875"    "197297106"



More information about the R-help mailing list