[R] Summarizing data based on Date

David L Carlson dcarlson at tamu.edu
Tue Jun 9 16:20:44 CEST 2015


What does the following command print out?

str(test)

The error message indicates that test$CHG_WT is not numeric.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Shivi82
Sent: Tuesday, June 9, 2015 7:01 AM
To: r-help at r-project.org
Subject: Re: [R] Summarizing data based on Date

Hi Petr 

I researched a lot over the net and R manual as well based on which I
revamped my code and came to the code as:
test$CR_DT <- as.Date(test$CR_DT, '%d-%b-%y')

iii<- aggregate(test$CHG_WT,list(format(test$CR_DT,"%m")),FUN=sum)

However it still gives me the error as below:
Error in Summary.factor(c(1L, 1L, 1L, 3286L, 1646L, 3241L, 1L, 1L, 1307L,  : 
  ‘sum’ not meaningful for factors. 

If could you guide on how to achieve the desired output. Thanks. 



--
View this message in context: http://r.789695.n4.nabble.com/Summarizing-data-based-on-Date-tp4708328p4708384.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


More information about the R-help mailing list