[R] Transform aggregated data to individual data

2013-11-14 Thread peron
Hello 

 

I have data in following form : 100 ind describe by two variables x and y.

 

D-data .frame( x=rnorm(3), y=rnorm(3), size=c(50,10,40))

 

I want data for individual, i.e, 100 observations for my 100 ind.

 

Thank for your help

 

Olivier Peron


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Transform aggregated data to individual data

2013-11-14 Thread Jim Lemon

On 11/14/2013 09:28 PM, peron wrote:

Hello



I have data in following form : 100 ind describe by two variables x and y.



D-data .frame( x=rnorm(3), y=rnorm(3), size=c(50,10,40))



I want data for individual, i.e, 100 observations for my 100 ind.


Hi Olivier,
From the above, it seems you have three values for the three groups. If 
you try:


df100-data.frame(x=rep(D$x,D$size),y=rep(D$y,D$size))

You will get what you request, if the values are the same for all 
members of each group. I suspect that those three values may be means or 
some other summary measure.


Jim

__
R-help@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.


Re: [R] Transform aggregated data to individual data

2013-11-14 Thread arun


Hi,
Try:
 D1 - D[rep(row.names(D),D[,3]),-3] ##assuming rownames(D) are from 1:nrow(D)
 row.names(D1) - 1:nrow(D1)
A.K.


On Thursday, November 14, 2013 5:32 AM, peron olivier.pe...@univ-pau.fr wrote:
Hello 



I have data in following form : 100 ind describe by two variables x and y.



D-data .frame( x=rnorm(3), y=rnorm(3), size=c(50,10,40))



I want data for individual, i.e, 100 observations for my 100 ind.



Thank for your help



Olivier Peron


    [[alternative HTML version deleted]]

__
R-help@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.


__
R-help@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.


Re: [R] Transform aggregated data to individual data

2013-11-14 Thread arun


HI,

A more general form would be:
 D[rep(1:nrow(D),D[,3]),-3]

A.K.


On Thursday, November 14, 2013 12:27 PM, arun smartpink...@yahoo.com wrote:


Hi,
Try:
 D1 - D[rep(row.names(D),D[,3]),-3] ##assuming rownames(D) are from 1:nrow(D)
 row.names(D1) - 1:nrow(D1)
A.K.


On Thursday, November 14, 2013 5:32 AM, peron olivier.pe...@univ-pau.fr wrote:
Hello 



I have data in following form : 100 ind describe by two variables x and y.



D-data .frame( x=rnorm(3), y=rnorm(3), size=c(50,10,40))



I want data for individual, i.e, 100 observations for my 100 ind.



Thank for your help



Olivier Peron


    [[alternative HTML version deleted]]

__
R-help@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.



__
R-help@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.

__
R-help@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.