Hi I have tried the first version, it works. BUT I have an additional problem. I expose;
The first I solved, I tried to execute on xx data.frame but I used a matrix wich columns I put name you see col.names=c("Date","Time","Tip") the thing was that I didn´t erase the name on the txt so the program bloked. Now I have solve and it works. I My question, I want to sum first only on Time but on minutes. Will I make this using Time ~ variable as you suggested? You see from 00 to 59 first without having the posibility of hours. The result will be something like a matrix with [2,60] columns. Second is to aggregate from 00 to 23 hours and for each time see the sum from 00 to 59 minutes. the new matrix will have 24 rows (hours),60 columns (minutes) size. It is not necessary to you to tell the solution only I need to know if applying reshape is easy or I will have to use loops... I saw that date function has the posibility to identify for instance minutes...but not in 2 colum date as I have only it will work if it is preceed by the Date a global. t <- as.Date(g$Time, format="%H:%M:%S") I hope I have explained... Sorry for the inconveniences to all and many thanks. 2011/6/10 John Kane <jrkrid...@yahoo.ca> > Here are two different ways with your data as the data.frame xx > > # Basic R > aggregate(xx$Tip, list(xx$Time), sum) > > # Using the rshape package > library(reshape2) > yy <- melt(xx, id=c("Time"), measure.vars=c("Tip")) > dcast(yy , Time ~ variable , sum) > > > --- On Thu, 6/9/11, Trying To learn again <tryingtolearnag...@gmail.com> > wrote: > > > From: Trying To learn again <tryingtolearnag...@gmail.com> > > Subject: [R] Item analysis > > To: r-help@r-project.org > > Received: Thursday, June 9, 2011, 4:41 PM > > Hi all, > > > > For several reasons I have no used CARN R in months....I > > have an idea and I > > want to retry to learn CRAN R. > > > > I know I need to formulate more "intelligent" questions but > > I will expose > > and if someone can help me I would be very gratefull I > > promise to try to > > learn again.... > > > > The question I have a data file like this: > > > > Date, Time, Tip > > 13/11/2008,23:16:00,432 > > 13/01/2009,23:17:00,633 > > 13/11/2009,23:16:00,134 > > 13/12/2009,23:17:00,234 > > 13/01/2010,23:16:00,111 > > > > I want to make an statistic (the sum of tip) but to extract > > one sum by each > > different minute in Time, so you see, in this easy example > > I will have a > > final table with two items: > > > > Item Sum > > 16 (432+134+111) > > 17 (633+234) > > > > Of course in my file (is bigger) I have minutes from 0 to > > 59. > > > > Would it be too much difficult if I want this analysis but > > on table for each > > day (indentified in the column Date) of the week. So you > > see on > > 13/11/2008 was thursday so you go each day and sum if > > this day is thrusday > > from 0 to 59 minutes... > > > > MAny thanks for all, each tip you give me I will send > > thousands of > > thanks¡¡¡¡¡ > > > > [[alternative HTML version deleted]] > > > > > > -----Inline Attachment Follows----- > > > > ______________________________________________ > > 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<http://www.r-project.org/posting-guide.html> > > and provide commented, minimal, self-contained, > > reproducible code. > > > [[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.