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

first and last fail for factors #2029

Closed
tmalsburg opened this issue Jul 20, 2016 · 2 comments
Closed

first and last fail for factors #2029

tmalsburg opened this issue Jul 20, 2016 · 2 comments
Labels

Comments

@tmalsburg
Copy link

@tmalsburg tmalsburg commented Jul 20, 2016

> first((1:3)[integer(0)])
[1] NA
> first(factor(1:3)[integer(0)])
Error: Don't know how to generate default for object of class factor

I would expect to get an NA for factors, too. Same problem for last.

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Nov 7, 2016

Thanks, confirmed. Internally, we check is.vector(factor(letters)[0]) which is FALSE but should not be.

Would you like to contribute a testthat test?

@krlmlr krlmlr added the bug label Nov 7, 2016
@hadley
Copy link
Member

@hadley hadley commented Feb 20, 2017

Similar problem for POSIXct and Date. Fix should be to make default_missing a generic. I'll do that tomorrow.

@hadley hadley closed this in 0c50018 Feb 20, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants