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

consistency between in_check ops and equality/comparison ops ? #13

Closed
moodymudskipper opened this issue Aug 18, 2019 · 8 comments
Closed

Comments

@moodymudskipper
Copy link
Owner

moodymudskipper commented Aug 18, 2019

do we agree that they should be consistent ?

if so we still have some work to do on them :

> test_chr <- c(names(iris), NA)
> test_num <- c(1:5,NA)
> test_list1 <- c(as.list(c(1:5,NA)),
+                 as.list(c(letters[1:5], NA)), 
+                 as.list(factor(c(letters[1:5], NA)))) 
> test_list2 <- list(1:3, c(4:5,NA) , 
+                    letters[1:3], c(letters[4:5], NA), 
+                    factor(c(letters[1:5], NA)))
> test_df <- data.frame(
+   a = 1:3, b = c(4:5,NA), c = letters[1:3], d = c(letters[4:5], NA), 
+   e = factor(letters[1:3]), f = factor(c(letters[4:5], NA)),stringsAsFactors = FALSE)
> 
> test_chr == 3
[1] FALSE FALSE FALSE FALSE FALSE    NA
> test_list1 == 3
 [1] FALSE FALSE  TRUE FALSE FALSE    NA    NA    NA    NA    NA    NA    NA FALSE FALSE  TRUE FALSE FALSE    NA
Warning messages:
1: NAs introduced by coercion 
2: NAs introduced by coercion 
3: NAs introduced by coercion 
4: NAs introduced by coercion 
5: NAs introduced by coercion 
> test_list2 == 3
Error: (list) object cannot be coerced to type 'double'
> test_df == 3
         a     b     c     d     e     f
[1,] FALSE FALSE FALSE FALSE FALSE FALSE
[2,] FALSE FALSE FALSE FALSE FALSE FALSE
[3,]  TRUE    NA FALSE    NA FALSE    NA
> 
> 
> test_chr %in{}% 3
[1] FALSE FALSE FALSE FALSE FALSE    NA
> test_list1 %in{}% 3
 [1] FALSE FALSE  TRUE FALSE FALSE    NA FALSE FALSE FALSE FALSE FALSE    NA FALSE FALSE FALSE FALSE FALSE    NA
> test_list2 %in{}% 3
[[1]]
[1] FALSE FALSE  TRUE

[[2]]
[1] FALSE FALSE FALSE

[[3]]
[1] FALSE FALSE FALSE

[[4]]
[1] FALSE FALSE FALSE

[[5]]
[1] FALSE FALSE FALSE FALSE FALSE FALSE

> test_df %in{}% 3
         a     b     c     d     e     f
[1,] FALSE FALSE FALSE FALSE FALSE FALSE
[2,] FALSE FALSE FALSE FALSE FALSE FALSE
[3,]  TRUE    NA FALSE    NA FALSE    NA
> 
> 
> test_chr %in% 3
[1] FALSE FALSE FALSE FALSE FALSE FALSE
> test_list1 %in% 3
 [1] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE
> test_list2 %in% 3
[1] FALSE FALSE FALSE FALSE FALSE
> test_df %in% 3
[1] FALSE FALSE FALSE FALSE FALSE FALSE
@moodymudskipper

This comment has been minimized.

@moodymudskipper
Copy link
Owner Author

I've pushed a few changes, including making %in{}% consistent, other check ops were ok, and I made tests for those

@karoliskoncevicius

This comment has been minimized.

@moodymudskipper

This comment has been minimized.

@karoliskoncevicius

This comment has been minimized.

@moodymudskipper
Copy link
Owner Author

regex ops must be made consistent as well + tests and then we can close this

@moodymudskipper
Copy link
Owner Author

regex ops defined and should behave ok, tests to design still

@moodymudskipper
Copy link
Owner Author

closing this as we have an issue about unit tests
#7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants