-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
assert
errors when making an assertion on multiple columns for a single-row data frame.
My guess is that that the issue involves the internals somewhere incorrectly treating the row as a vector, rather than as multiple length-one vectors. assert
works fine with one-row-one-column, or multiple-rows-multiple-columns
Reproducible example, asserting on two columns with a single-row data frame:
library(assertr)
library(magrittr)
head(mtcars, 1) %>% assert(not_na, am, vs)
#> Error in dimnames(x) <- dn: length of 'dimnames' [2] not equal to array extent
packageVersion("assertr")
#> [1] '2.7'
Note that this error does not occur when asserting about only a single column for a single-row data frame:
library(assertr)
library(magrittr)
head(mtcars, 1) %>% assert(not_na, am)
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4
or asserting about multiple columns with multiple-row data frames:
library(assertr)
library(magrittr)
head(mtcars, 2) %>% assert(not_na, am, vs)
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> Mazda RX4 21 6 160 110 3.9 2.620 16.46 0 1 4 4
#> Mazda RX4 Wag 21 6 160 110 3.9 2.875 17.02 0 1 4 4
Created on 2020-03-05 by the reprex package (v0.3.0)
krystian8207, xmichelleli, brentonk, nfruehADA, idefer and 1 more
Metadata
Metadata
Assignees
Labels
No labels