-
Notifications
You must be signed in to change notification settings - Fork 2.1k
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with Date format #194
Comments
Looks like we need to add a Date method to our internal implementation of If you want all the columns of the original dataset, use |
Thank you for the instant reply! When I use d_dplyr %.% group_by(ID) %.% mutate(mindate=min(date))
ID date number mindate
1 a 1992-06-17 -3.11321730 327283200
2 a 1999-04-09 -0.94135740 327283200
3 a 1980-05-16 1.40025878 327283200
4 a 1988-05-24 -1.62047003 327283200
5 a 1980-12-15 -2.26599596 327283200
6 b 1983-04-10 1.16299359 -296352000
7 b 1960-08-11 -0.11615504 -296352000
8 b 1989-04-22 0.33425601 -296352000
9 b 1983-10-16 -0.62085811 -296352000
10 b 1965-08-20 -1.30984491 -296352000
11 c 1990-01-19 -1.17572604 -238723200
12 c 1992-07-15 -1.12121553 -238723200
13 c 1963-06-01 -1.36190448 -238723200
14 c 1962-06-09 0.48112458 -238723200
15 c 1968-05-25 0.74197163 -238723200
16 d 1984-09-14 0.02782463 -27648000
17 d 1969-02-15 0.33137971 -27648000
18 d 2013-10-12 0.64411413 -27648000
19 d 1977-08-03 2.48566156 -27648000
20 d 1993-10-21 1.95998171 -27648000
|
Then maybe you want |
That´s exactly what I wanted! |
internal
But however not handling it for arbitrary functions:
@hadley, should we e.g. promote the object to have the class of say the first result ? |
@romainfrancois hmmm, can you expand a bit more why the second case doesn't work already? Why are we losing the class information returned by |
It is just an omission. The subsetting happens in the GroupSubset class: https://github.com/hadley/dplyr/blob/master/inst/include/dplyr/Result/GroupedSubset.h which then uses ShrinkableVector: which does not keep attributes. That is one side of the problem, so the The other side of the problem is the fusion of all results for the chunks. but I think this should be taken care of. If we go there, should only |
A shallow copy of attributes would work for dates, times and factors, but not necessarily in general. The problem is that S3 classes don't provide quite enough information about what attributes mean. Perhaps we could maintain a registry of classes, and when attributes should be preserved across vector operations. Or for now, we could just special case POSIXct, Date and factor, and leave worrying about other classes until the future. |
Ok, so for now I'm propagating all attributes and also setting the object bit if it is set in the original variable. |
Reopening until i put some unit tests |
Can you please also add a note to NEWS.md (just added)? |
There still seems to be an issue when using
|
@jmb1 that works for me with the dev version |
Thanks, problem solved after |
Hi!
Thank you for developing the
dplyr
package!I used the package for the very first time and I had some issues with date vectors. I browsed the issues but haven´t found a solution for the problem.
Here is what happens if I want to use
summarise()
in order to get the 'earliest' observation from my data.frame.select()
etc., but I never got back the 'big' & summerised data.frame.Thank you!
Manuel
The text was updated successfully, but these errors were encountered: