[R] questions on aggregate data

2006-08-02 Thread zhijie zhang
Dear friends,
 my question is how to aggregate dataset  and the inverse manipulation.
e.g.My dataset
data structure1:
x
 1
1
2
3
3
data structure2:
x  freq
1  2
2  1
3  2
Then how to generate dataset2 from dataset1 and generate dataset1 from
dataset2?

e.g. dataset2 from dataset1 :
x-c(1,1,2,3,3)
a-tab(x)
as.data.frame(a)

*But i can't do the inverse manipulation:generate dataset1 from dataset2*,
anybody can help me on the two different manipulations?

Thanks a lot!





-- 
Kind Regards,
Zhi Jie,Zhang ,PHD
Department of Epidemiology
School of Public Health
Fudan University
Tel:86-21-54237149

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] questions on aggregate data

2006-08-02 Thread Jacques VESLOT
data.frame(x = with(df1, rep(x, freq)))
---
Jacques VESLOT

CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex

Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31

http://www-good.ibl.fr
---


zhijie zhang a écrit :
 Dear friends,
  my question is how to aggregate dataset  and the inverse manipulation.
 e.g.My dataset
 data structure1:
 x
  1
 1
 2
 3
 3
 data structure2:
 x  freq
 1  2
 2  1
 3  2
 Then how to generate dataset2 from dataset1 and generate dataset1 from
 dataset2?
 
 e.g. dataset2 from dataset1 :
 x-c(1,1,2,3,3)
 a-tab(x)
 as.data.frame(a)
 
 *But i can't do the inverse manipulation:generate dataset1 from dataset2*,
 anybody can help me on the two different manipulations?
 
 Thanks a lot!
 
 
 
 


__
R-help@stat.math.ethz.ch 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.