[R] split/decompose lines
Ben Bolker
bolker at ufl.edu
Sun Feb 22 16:37:46 CET 2009
Mafalda Viana-2 wrote:
>
>
> I need to split (or decompose) one line into many lines using one field as
> a
> reference.
>
> I have a table with the following format:
>
> A B Frequency
> 23 3 2
> 24 2 5
> 25 1 3
>
>
olddata[rep(1:nrow(olddata),olddata$B),]
repeats the rows of the data frame the appropriate number
of times. The new Frequency column is trivial
(rep(1,sum(olddata$B))
Ben Bolker
--
View this message in context: http://www.nabble.com/split-decompose-lines-tp22146585p22148058.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list