Re: [R] split a row into multiple columns

From: jim holtman <jholtman_at_gmail.com>
Date: Thu, 03 Jun 2010 15:39:10 -0400

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?

______________________________________________
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.
Received on Thu 03 Jun 2010 - 19:41:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 04 Jun 2010 - 19:00:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive