Skip to contents

This function takes a diffdf object and a dataframe and subsets the dataframe for problem rows as identified in the comparison object. If vars has been specified only issue rows associated with those variable(s) will be returned.

Usage

diffdf_issuerows(df, diff, vars = NULL)

Arguments

df

dataframe to be subsetted

diff

diffdf object

vars

(optional) character vector containing names of issue variables to subset dataframe on. A value of NULL (default) will be taken to mean available issue variables.

Details

Note that diffdf_issuerows can be used to subset against any dataframe. The only requirement is that the original variables specified in the keys argument to diffdf are present on the dataframe you are subsetting against. However please note that if no keys were specified in diffdf then the row number is used. This means using diffdf_issuerows without a keys against an arbitrary dataset can easily result in nonsense rows being returned. It is always recommended to supply keys to diffdf.

Examples

iris2 <- iris
for ( i in 1:3) iris2[i,i] <- 99
x <- diffdf( iris , iris2, suppress_warnings = TRUE)
diffdf_issuerows( iris , x)
#>   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1          5.1         3.5          1.4         0.2  setosa
#> 2          4.9         3.0          1.4         0.2  setosa
#> 3          4.7         3.2          1.3         0.2  setosa
diffdf_issuerows( iris2 , x)
#>   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1         99.0         3.5          1.4         0.2  setosa
#> 2          4.9        99.0          1.4         0.2  setosa
#> 3          4.7         3.2         99.0         0.2  setosa
diffdf_issuerows( iris2 , x , vars = "Sepal.Length")
#>   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1           99         3.5          1.4         0.2  setosa
diffdf_issuerows( iris2 , x , vars = c("Sepal.Length" , "Sepal.Width"))
#>   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1         99.0         3.5          1.4         0.2  setosa
#> 2          4.9        99.0          1.4         0.2  setosa