[R] Scaling data

Henrique Dallazuanna wwwhsd at gmail.com
Wed Sep 30 18:57:10 CEST 2009


Try this:

as.data.frame(sapply(sapply(DF, as.character, simplify = FALSE), strsplit, ";"))

On Wed, Sep 30, 2009 at 1:18 PM, Dry, Jonathan R
<Jonathan.Dry at astrazeneca.com> wrote:
> Hello all
>
> I am manipulating some data and wish to expand/unmerge (i.e. do the opposite of aggregate) rows in a data matrix based on the values in a particular column and a seperator, e.g.
>
> Col1    Col2
> n1;n2   6
>
> ...separating by ";" becomes....
>
> Col1    Col2
> num1    6
> num2    6
>
> Any ideas?
>
> Also can I do this based on values in two columns?  EG:
>
> Col1    Col2    Col3
> n1;n2   ID1;ID2 6
>
> ...becomes....
>
> Col1    Col2    Col3
> n1      ID1     6
> n2      ID2     6
> ?
>
> --------------------------------------------------------------------------
> AstraZeneca UK Limited is a company incorporated in Engl...{{dropped:21}}
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O




More information about the R-help mailing list