[R] split a row into multiple columns
jim holtman
jholtman at gmail.com
Thu Jun 3 21:39:10 CEST 2010
If you want a matrix, then just create one from the data you have:
mydata <- matrix(strsplit(x, '\t')[[1]], nrow=1)
On Thu, Jun 3, 2010 at 1:30 PM, Kevin Burnham <kburnham at gmail.com> wrote:
> Would somebody please help me break this row:
>
> "Main Group\t1000\tMP Test\tMP Test, 1\tAudio (1, f1-qaddara.aiff)\tl
> (target is right word)\tl\tPressed\tl (target is right
> word)\tC\t3111\t\t\t\t\t"
>
> into multiple columns along the \t separator?
>
> When I try the strsplit (x,"\t") command I get:
>
> [[1]]
> [1] "Main Group" "1000" "MP
> Test" "MP Test, 1" "Audio (1,
> f1-qaddara.aiff)"
> [6] "l (target is right word)" "l"
> "Pressed" "l (target is right word)"
> "C"
> [11] "3111" ""
> "" "" ""
>
> Which which is closer to what I need, but still not in columns.
>
> Thanks,
> Kevin
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help
mailing list