markmfredrickson / optmatch

Functions for optimal matching in R
https://markmfredrickson.github.io/optmatch
Other
47 stars 14 forks source link

subset on un-named ISMs #204

Closed josherrickson closed 3 years ago

josherrickson commented 3 years ago
> a
       control
treated [,1] [,2]
   [1,]   20   40
   [2,]  Inf   10
> subset(a, subset = c(TRUE, TRUE), select = c(TRUE, FALSE))
       control
treated [,1]
   [1,]   20

Believe this is related to the lack of names on the dimensions.

> b
       control
treated          H          I
      A 0.09781492 0.05678264
      B        Inf        Inf
> subset(b, subset = c(TRUE, TRUE), select = c(TRUE, FALSE))
       control
treated          H
      A 0.09781492
      B        Inf
benthestatistician commented 3 years ago

We can circumvent this by requiring ISMs to have row and column names.

josherrickson commented 3 years ago

Figured out the issue - subset.ISM needed to be given the proper dimensions explicitly.