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

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

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

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

hadley opened this issue May 18, 2016 · 2 comments
Labels
feature a feature request or enhancement

Comments

@hadley
Copy link
Member

hadley commented May 18, 2016

No description provided.

@wolkym
Copy link

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
Copy link
Member Author

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
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 a feature request or enhancement label Mar 3, 2017
@hadley hadley closed this as completed in 53fcb3e Mar 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants