This might not be the most elegant way of doing it, but it should probably
work, given that data is always separated by a "_".

string.1<-strsplit(c("GenusA_SpeciesC_Tree","GenusA_SpeciesF_Tree",
"GenusB_SpeciesA_Shrub"),"_")

matrix(unlist(string.1),ncol=3,byrow=TRUE)

2010/6/1 Joël Baumann <joelbaum...@gmx.net>

> Hello!
>
> I have the following problem:
>
> I have a file in R that has in the first row three informations in one row
> that I would like to in three different rows.
>
> The first row looks like this:
>
> GenusA_SpeciesC_Tree
> GenusA_SpeciesF_Tree
> GenusB_SpeciesA_Shrub
> ...
>
> I tried with strsplit and and substring but I don't get any solution. I
> know I can do this in Excel, but in R would be much nicer!
>
> Thanks for helping me.
>
> Joël Baumann
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to