-
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
coalesce() function "Must subset elements with valid subscript vector" #5326
Comments
Minimal example coalesce(data.frame(x = c(NA, 1)), data.frame(x = 1:2))
#> Error: Must subset elements with a valid subscript vector.
#> ✖ Subscript must be a simple vector, not a matrix. |
I'm also experiencing this error after updating to 1.0.0 today for a similar data situation to those which lionel and mlok2u provided above. It had been working prior to updating. |
I'll take a look now. |
As far as I can tell this never worked properly. The behaviour with data frames is not documented in out <- dplyr::coalesce(data.frame(x = c(NA, 1)), data.frame(x = 1:2))
str(out)
#> 'data.frame': 2 obs. of 1 variable:
#> $ x:List of 2
#> ..$ : int 1 2
#> ..$ : num 1 So I think you were relying on undefined behaviour. We should probably make it work with data frames but that will require some thinking and the behaviour will be different than in 0.8.5. |
It appeared to have worked when using dplyr 0.7.7. |
I've just tried with 0.7.7 and I see the same non-sensical output as in my last comment. I have prepared a fix but the behaviour will be different, the data frames will be coalesced columns by columns. |
Awesome - thanks for looking into this! |
Hi,
I have historically been able to wrap the coalesce() function with a function that will identify suffixed columns in a dataframe and coalesce accordingly.
However, after updating to v.1.0.0, the functionality appears to be broken due to the following exception:
"Must subset elements with a valid subscript vector."
Brief description of the problem
The text was updated successfully, but these errors were encountered: