
R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin12.2.1 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> require('optmatch')
> 
> data(plantdist)
> # warnings about lacking data argument are expected
> pairmatch(plantdist)
   A    B    C    D    E    F    G    H    I    J    K    L    M    N    O    P 
 1.1  1.2  1.3  1.4  1.5  1.6  1.7 <NA>  1.1  1.2 <NA>  1.3 <NA> <NA> <NA> <NA> 
   Q    R    S    T    U    V    W    X    Y    Z 
 1.4  1.5 <NA> <NA>  1.6 <NA> <NA>  1.7 <NA> <NA> 
> pairmatch(plantdist, controls=2)
   A    B    C    D    E    F    G    H    I    J    K    L    M    N    O    P 
 1.1  1.2  1.3  1.4  1.5  1.6  1.7 <NA>  1.1  1.2 <NA>  1.2  1.4  1.3 <NA> <NA> 
   Q    R    S    T    U    V    W    X    Y    Z 
 1.4  1.5  1.5  1.3  1.6 <NA>  1.1  1.7  1.7  1.6 
> ## Not run: pairmatch(plantdist + caliper(plantdist, 1)) # Matching fails everywhere
> pairmatch(plantdist + caliper(plantdist, 5, compare = `<`), remove.unmatchables=TRUE) # Matching works after removing plant 'F'
   A    B    C    D    E    F    G    H    I    J    K    L    M    N    O    P 
 1.1  1.2  1.3  1.4  1.5 <NA>  1.6 <NA>  1.1  1.2 <NA>  1.3 <NA> <NA> <NA> <NA> 
   Q    R    S    T    U    V    W    X    Y    Z 
 1.4  1.5 <NA> <NA> <NA> <NA> <NA>  1.6 <NA> <NA> 
> 
> data(nuclearplants)
> # in both of match_on calls below use sd to maintain backwards compatibility with
> # pscore.dist, which used sd by default. match_on has used mad as the std. scale
> # since it was added to the package, so the use of match_on should be consistent
> # for users going forward.
> psm <- glm(pr~.-(pr+cost), family=binomial(), data=nuclearplants)
> psd <- match_on(psm, standardization.scale = sd)
> pairmatch(psd, controls=2, data = nuclearplants)
   H    I    A    J    B    K    L    M    C    N    O    P    Q    R    S    T 
 1.7  1.9  1.2 1.10  1.4 <NA>  1.8  1.2  1.6  1.6  1.7  1.3  1.3  1.5  1.4  1.1 
   U    D    V    E    W    F    X    G    Y    Z    d    e    f    a    b    c 
 1.2  1.7  1.1  1.8  1.4  1.9 1.10 1.10  1.6  1.8  1.9 <NA>  1.5  1.1  1.3  1.5 
> 
> # Also not run: again an error would be thrown (which R CMD CHECK does not like)
> # pairmatch(caliper(match_on(psm, standardization.scale = sd,
> #   within = exactMatch(pr ~ pt, data =
> #   nuclearplants)), width=2)) # Fails in subclass '1'
> 
> 
