Skip to content
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

fill not respecting groups? #129

Closed
derekholmes opened this issue Oct 25, 2015 · 8 comments
Closed

fill not respecting groups? #129

derekholmes opened this issue Oct 25, 2015 · 8 comments

Comments

@derekholmes
Copy link

It looks like fill isn't respecting groupings in the following

df <- data.frame(id="X", Month = 1:3, Year = c(2000, NA,NA))
dfa <- data.frame(id="Y", Month = 1:3, Year = c(NA,2001,NA))
group_by(rbind(df,dfa),id) %>% tidyr::fill(Year) %>% as.data.frame()
id Month Year
1 X 1 2000
2 X 2 2000
3 X 3 2000
4 Y 1 2000 <<< s/b NA
5 Y 2 2001
6 Y 3 2001

@jjcad
Copy link

jjcad commented Dec 29, 2015

+1 needs to be fixed. Was pointed here by a comment on my SO thread. http://stackoverflow.com/questions/34517370/group-by-into-fill-not-working-as-expected

@hadley hadley closed this as completed in 849aab5 Dec 30, 2015
@naveennjs
Copy link

Was this fixed ? I am doing something similar.
df%>%group_by(id,name%>%fill(amount) does not yield the correct results. I am using tidyR version 0.6.1

@liyi-1989
Copy link

Same problem for me. It looks like group_by() will be ignored if it follows arrange() or fill().

@ainhoavega
Copy link

I've spent a full day trying to find a workaround to this problem. Does anyone have any suggestions? Thanks in advance

@yutannihilation
Copy link
Member

This issue seems fixed. If you feel there's still a same kind of problem, I guess your problem is different, so you should file a new issue with the reproducible example (reprex) for it.

library(tidyr)
library(dplyr, warn.conflicts = FALSE)

packageVersion("tidyr")
#> [1] '0.8.1'

df <- data.frame(id="X", Month = 1:3, Year = c(2000, NA, NA))
dfa <- data.frame(id="Y", Month = 1:3, Year = c(NA, 2001, NA))
group_by(rbind(df,dfa),id) %>% tidyr::fill(Year) %>% as.data.frame()
#>   id Month Year
#> 1  X     1 2000
#> 2  X     2 2000
#> 3  X     3 2000
#> 4  Y     1   NA
#> 5  Y     2 2001
#> 6  Y     3 2001

Created on 2018-08-04 by the reprex package (v0.2.0).

@ainhoavega
Copy link

ainhoavega commented Aug 3, 2018 via email

@yutannihilation
Copy link
Member

yutannihilation commented Aug 3, 2018

I'm just saying closed GitHub issues are not the good place to ask questions, especially when you can't provide the reprex.

Do you know RStudio Community? I think it's more probable to get the answer there :)

https://community.rstudio.com

@ainhoavega
Copy link

ainhoavega commented Aug 4, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants