On 01/18/2011 07:05 PM, Henrique Dallazuanna wrote: > Or: > > read.table(textConnection(as.matrix(df)), sep = " ")
no, that's too simple: you can't use regular expressions. (well, i guess it's enough for the original problem.) vQ > > > On Tue, Jan 18, 2011 at 11:02 PM, Waclaw Kusnierczyk <w...@idi.ntnu.no > <mailto:w...@idi.ntnu.no>> wrote: > > Assuming every row is split into exactly two values by whatever > string you choose as split, one fancy exercise in R data structures is > > dfsplit = function(df, split) > as.data.frame( > t( > structure(dim=c(2, nrow(df)), > unlist( > strsplit(split=split, > as.matrix(df)))))) > > so that if your data frame is > > df = data.frame(c('1 2', '3 4', '5 6')) > > then > > dfsplit(df, ' ') > # V1 V2 > # 1 1 2 > # 2 3 4 > # 3 5 6 > > renaming the columns left as an exercise. > [[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.