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

map2 should understand that NULL is a length-0 vector #199

Closed
hadley opened this Issue May 18, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@hadley
Member

hadley commented May 18, 2016

No description provided.

@wolkym

This comment has been minimized.

wolkym commented Jul 19, 2016

@hadley what is the reason for such rule?
Natively they are not equivalent and may be it is better to use Nil or some kind of other alias.

> is.null(vector(mode = "logical", length = 0))
[1] FALSE

I use zero length lists and avoid NULL in some cases, because I cannot rbind them afterwards using data.table::rbindlist.

@hadley

This comment has been minimized.

Member

hadley commented Nov 21, 2016

In general, it's probably pragmatic to treat all 0-length vectors and NULL as coercible to any type. R isn't strict enough about types that I think treating these things differently will cause more pain than it reduces.

mdlincoln added a commit to mdlincoln/fuzzr that referenced this issue Dec 29, 2016

Add null value test (currently failing)
Because of an open issue in purrr (tidyverse/purrr#199), cross_n cannot handle a named list with the value NULL. This must be resolved in order to use null values in fuzzr_ tests.

@hadley hadley added the feature label Mar 3, 2017

@hadley hadley closed this in 53fcb3e Mar 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment