d. sarthi maheshwari
2007-Feb-14 10:40 UTC
[R] Is this a correct forum to discuss basic R problem?
Hi Sorry if this is a wrong post in the forum. Please suggest if this is a correct forum to discuss R related basic problem. I wanted to perform the following task by using R: e.g. input data.frame x y ===========a 10 b 20 a 10 a 10 b 15 b 15 b 20 In o/p i need x y ========a 30 b 70 Currently i am storing the data.frame as a database table by using sqlSave. Then I am retrieving the data using sqlQuery command. In the query I am using Group by function of SQL. is there any smarter way to this in R? -- thanks Sar [[alternative HTML version deleted]]
Henrique Dallazuanna
2007-Feb-14 10:51 UTC
[R] Is this a correct forum to discuss basic R problem?
Yes, df is your data.frame. tapply(df$y, df$x, sum) On 14/02/07, d. sarthi maheshwari <samay.sar@gmail.com> wrote:> > Hi > > Sorry if this is a wrong post in the forum. Please suggest if this is a > correct forum to discuss R related basic problem. > > I wanted to perform the following task by using R: > > e.g. > input data.frame > x y > ===========> a 10 > b 20 > a 10 > a 10 > b 15 > b 15 > b 20 > > In o/p i need > > x y > ========> a 30 > b 70 > > Currently i am storing the data.frame as a database table by using > sqlSave. > Then I am retrieving the data using sqlQuery command. In the query I am > using Group by function of SQL. > > is there any smarter way to this in R? > > > -- > thanks > Sar > > [[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. >-- Henrique Dallazuanna Curitiba-ParanĂ¡ Brasil [[alternative HTML version deleted]]
ONKELINX, Thierry
2007-Feb-14 10:51 UTC
[R] Is this a correct forum to discuss basic R problem?
?aggregate ?by ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx op inbo.be www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -----Oorspronkelijk bericht----- Van: r-help-bounces op stat.math.ethz.ch [mailto:r-help-bounces op stat.math.ethz.ch] Namens d. sarthi maheshwari Verzonden: woensdag 14 februari 2007 11:41 Aan: r-help op stat.math.ethz.ch Onderwerp: [R] Is this a correct forum to discuss basic R problem? Hi Sorry if this is a wrong post in the forum. Please suggest if this is a correct forum to discuss R related basic problem. I wanted to perform the following task by using R: e.g. input data.frame x y ===========a 10 b 20 a 10 a 10 b 15 b 15 b 20 In o/p i need x y ========a 30 b 70 Currently i am storing the data.frame as a database table by using sqlSave. Then I am retrieving the data using sqlQuery command. In the query I am using Group by function of SQL. is there any smarter way to this in R? -- thanks Sar [[alternative HTML version deleted]] ______________________________________________ R-help op 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.