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

Move predicates into own package #124

Closed
hadley opened this Issue Nov 9, 2015 · 18 comments

Comments

Projects
None yet
6 participants
@hadley
Member

hadley commented Nov 9, 2015

Since they're useful in many places

@gaborcsardi do you already have a mini package for predicates? In purrr, we have:

is_atomic <- function(x) {
  typeof(x) %in% c("logical", "integer", "double", "complex", "character", "raw")
}
is_vector <- function(x) {
  is_atomic(x) || is.list(x)
}
is_bare_list <- function(x) {
  !is.object(x) && is_list(x)
}

etc

@gaborcsardi

This comment has been minimized.

gaborcsardi commented Nov 9, 2015

Micropackage. :) Not yet. But happy to have one. :)

We just want them to return TRUE/FALSE? I often find it useful if they can also return an error message.

@smbache

This comment has been minimized.

Member

smbache commented Nov 9, 2015

+1

@smbache

This comment has been minimized.

Member

smbache commented Nov 9, 2015

I think true / false is best (more generally applicable). But perhaps as attribute.

@gaborcsardi

This comment has been minimized.

gaborcsardi commented Nov 9, 2015

Btw. there are already a lot of assertions in the assertive.* packages, e.g. http://www.r-pkg.org/pkg/assertive.numbers

@jennybc

This comment has been minimized.

Member

jennybc commented Nov 9, 2015

@gaborcsardi: following that link made me realize that 14 of the 16 assertive.* packages don't seem to be in the METACRAN mirror?

https://github.com/search?q=user%3Acran+assertive&type=Repositories

@lionel-

This comment has been minimized.

Member

lionel- commented Nov 9, 2015

Instead of a micro-package, do we need a "standard lib" package with underscored function names and sane behaviours? This would be a good home for set_names() (#119) etc. Could be called lowliner ;)

@smbache

This comment has been minimized.

Member

smbache commented Nov 9, 2015

Or if only for predicates, "predrcats" ;-)

@smbache

This comment has been minimized.

Member

smbache commented Nov 9, 2015

With a cat hex logo

@gaborcsardi

This comment has been minimized.

gaborcsardi commented Nov 9, 2015

@jennybc yeah, the GitHub mirroring is not working now, I'll fix it soon.

@hadley

This comment has been minimized.

Member

hadley commented Nov 9, 2015

I do like predrcats!

@imanuelcostigan

This comment has been minimized.

imanuelcostigan commented Jan 9, 2016

Is there a reason why is_na is not available ? I am happy to help transport these predicates to a separate package if help is needed.

@smbache

This comment has been minimized.

Member

smbache commented Jan 9, 2016

@imanuelcostigan is_na %>% is_na

@imanuelcostigan

This comment has been minimized.

imanuelcostigan commented Jan 9, 2016

@smbache

This comment has been minimized.

Member

smbache commented Jan 9, 2016

Just found it amusing that you point out that is_na is not available (i.e. is_na)... :-)

@imanuelcostigan

This comment has been minimized.

imanuelcostigan commented Jan 9, 2016

ok LOLz

@imanuelcostigan

This comment has been minimized.

imanuelcostigan commented Mar 18, 2016

@lionel- i have been also been thinking that something like that would be sweet.

Been reading Swift's API design guidelines (ugh...camelCase) and reflecting on the lack of design principles in R's core packages (not just camelCase vs snake_case). That isn't surprising given its genesis.

@imanuelcostigan

This comment has been minimized.

imanuelcostigan commented Apr 16, 2016

@hadley

This comment has been minimized.

Member

hadley commented Mar 3, 2017

Will be moving into rlang

@hadley hadley added the feature label Mar 3, 2017

@hadley hadley closed this in 0b11cc0 Mar 7, 2017

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