whichDif: Determine which columns differ in a two-row data.frame

View source: R/whichDif.R

whichDifR Documentation

Determine which columns differ in a two-row data.frame

Description

This function takes a two-row data.frame and determines which cells differ. For example, say you've got a data.frame of all the subjects in your study and one subject is listed twice, even after you type unique(MyDF). There are dozens of columns in MyDF, so finding the columns that differs would be tedious. This function will do that for you.

Usage

whichDif(x, ignore.na = TRUE)

Arguments

x

A two-row data.frame

ignore.na

TRUE or FALSE for whether to ignore NA values. Default is TRUE. If ignore.na = TRUE, then one column with a missing value and another column with a complete case will be counted as a match and the missing value will be filled in with the complete one. If ignore.na = FALSE, then one missing value and one complete case always counts as a mismatch.

Value

a character vector of the column names where value differ

Examples

data(Pets)
whichDif(Pets[Pets$Name == "Eddie", ])



shirewoman2/LaurasHelpers documentation built on Oct. 22, 2023, 2:07 p.m.