Learn R Programming

eatGADS (version 1.1.1)

compareGADS: Compare two GADS.

Description

Compare multiple variables of two GADSdat or all_GADSdat objects.

Usage

compareGADS(
  GADSdat_old,
  GADSdat_new,
  varNames,
  output = c("list", "data.frame", "aggregated")
)

Value

Returns either a list with "all equal" and data.frames or a single data.frame.

Arguments

GADSdat_old

GADSdat object imported via eatGADS.

GADSdat_new

GADSdat object imported via eatGADS.

varNames

Character string of variable names to be compared.

output

How should the output be structured?

Details

Returns "all equal" if the variable is identical across the objects or a data.frame containing a frequency table with the values which have been changed. Especially useful for checks after recoding.

Examples

Run this code
# Recode a GADS
pisa2 <- recodeGADS(pisa, varName = "schtype",
                        oldValues = 3, newValues = 9)
pisa2 <- recodeGADS(pisa2, varName = "language",
                        oldValues = 1, newValues = 15)

# Compare
compareGADS(pisa, pisa2,
            varNames = c("ganztag", "schtype", "language"), output = "list")
compareGADS(pisa, pisa2,
            varNames = c("ganztag", "schtype", "language"), output = "data.frame")
compareGADS(pisa, pisa2,
             varNames = c("ganztag", "schtype", "language"), output = "aggregated")

Run the code above in your browser using DataLab