[R] Problem with spliting a dataframe values

David Winsemius dwinsemius at comcast.net
Thu Dec 17 16:40:10 CET 2009


On Dec 17, 2009, at 8:11 AM, venkata kirankumar wrote:

> Hi all,
> Hi this is kiran
> I am facing a problem to split a dataframe
>
> that is..
> i have a string like:    "a,b,c|1,2,3|4,5,6|7,8,8"
> first I have to split  with respect to   "|"
> I did it with  command
>
> unlist(strsplit("a,b,c|1,2,3|4,5,6|7,8,8", "\\,"))

Removes all the commas, leaves the "pipes".
>
>
> after getting that set i made it as a dataframe and it comes like
>
> a,b,c
> 1,2,3
> 4,5,6
> 7,8,8

Some other code might have done that, but not the code you offered.  
Why don't you explain why you want to manipulate your data this way  
and provide a self-contained session transcript. Then the helpeRs can  
figure out how to offer sensible alternatives.

-- 
David.
>
> now i have to split this dataframe with respect to ","  and i have  
> to get it
> like
>
>
> a b c
> 1 2 3
> 4 5 6
> 7 8 8
>
>
> this one i am not able to findout
> can any one help me to get it done
>
> thanks in advance
> kiran
>
> 	[[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.




More information about the R-help mailing list