[R] strsplit with dataframes

Henrik Andersson h.andersson at nioo.knaw.nl
Thu Dec 22 12:07:45 CET 2005

Hello fellow R people,

I can not figure out a pretty way to use strplit with vectors

Imagine that I got the following data from someone with ID's 
representing several factors

ID 		data
A1-B1-t1	0
A1-B1-t2	1
A1-B2-t1	5
A1-B2-t2	10
A1-B10-t1	0
A1-B10-t2	1
A1-B20-t1	5
A1-B20-t2	10


I would like to turn this dataframe to

station substation time data
A1 	B1 	t1	0
A1 	B1 	t2	1
A1 	B2 	t1	5
A1 	B2 	t2	10
A1 	B10 	t1	0
A1 	B10 	t2	1
A1 	B20 	t1	5
A1 	B20 	t2	10

This must surely be done easily, but there are not an example like this 
in ?strsplit

Henrik Andersson
Netherlands Institute of Ecology -
Centre for Estuarine and Marine Ecology
P.O. Box 140
4400 AC Yerseke
Phone: +31 113 577472
h.andersson at nioo.knaw.nl

More information about the R-help mailing list