[R] Date as Integer

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sat Aug 22 15:28:36 CEST 2015


Use mutate to change the date before you use group_by.

Posting incomplete fragments in your questions is usually not enough to get useful help with R on the internet. Please add the extra few lines of code that would make it reproducible [1] from now on.

[1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example 
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On August 22, 2015 12:43:05 AM PDT, Shivi82 <shivibhatia at ymail.com> wrote:
>Hi All,
>
>I am using dplyr package and need to find total bills booked grouped on
>a
>date level however my date is integer. 
>In the code below i was trying to change date format from integer.
>However
>it is throwing an error:
>
>"no applicable method for 'group_by_' applied to an object of class
>"c('integer', 'numeric')"
>
>ak%>%
>  group_by(as.Date(pickdate),"%y%m%d")%>%
>  summarise(Total=count(waybill))
>
>Do i need to create a new var first changing the date and then group it
>or
>as.Date will work as i added in dplyr.
>
>
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Date-as-Integer-tp4711377.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