-
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
unique names for data.table + lag for unbalanced panel #633
Conversation
Oh hmmm, I think a better solution would be to use just a non-syntactic name like |
Ok. I changed it. |
add match_by as an option for lead and lag
I've added an option This is an important command (at least in social sciences) and the current solution (left_join) is not as satisfying (wrt syntax and performance). Related discussions: Update: library(lubridate)
df <- data.frame(
id = c("1", "1", "1", "1"),
date = mdy(c("03/01/1992", "04/03/1992", "07/15/1992", "08/21/1992")),
value = c(4.1, 4.5, 3.3, 5.3)
)
df <- df %>% mutate(date = floor_date(date, "month"))
df %>% group_by(id) %>% mutate(lag(value, months(1), along_with = date)) |
Add incomparable = NA
Inplace = TRUE creates a variable equal to true in current version of dplyr. I corrected it and added the option in select. |
added that |
add merge on different variable names (like data.frames) #694 . Moreover, copy data.table only if data.tables must be rekeyed or if variables must be renamed. |
# Accept different names | ||
# In future versions, the command copy below may be replaced by shallow copies. | ||
|
||
# first check no duplicates (not accepted in merge.data.table) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to wait on shallow copies here
I think this is a good idea in principle, but I've started adding a better abstraction - take a look at the new |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
dt
orvars
.Solution is is only implemented for filter_.data.table and filter_.grouped_dt as I was not sure it was the right way to do it.