Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new class for handling input parameters #13

Open
zkamvar opened this issue Aug 4, 2016 · 1 comment
Open

Create new class for handling input parameters #13

zkamvar opened this issue Aug 4, 2016 · 1 comment

Comments

@zkamvar
Copy link
Contributor

zkamvar commented Aug 4, 2016

Currently the way to enter parameters for matching data is quite awkward as it a list of lists:

funlist <- list(
             list(d1vars = "ID",
                  d2vars = "ID",
                  fun = "nameDists",
                  extraparams = NULL,
                  weight = 1),
             list(d1vars = c("Surname", "OtherNames"),
                  d2vars = c("SurnameLab", "OtherNameLab"),
                  fun = "nameDists",
                  extraparams = NULL,
                  weight = 0.5)
           )

Instead of this monstrosity, it could be converted into a couple of S4 class objects and given accessors (and subsetters like "[["). This way the process could be something like:

IDparam <- new("paramclass", fun = "nameDists")
NAMEparam <- new("paramclass", fun = "nameDists")

vars(IDparam)     <- list("ID", "ID")
vars(NAMEparam)   <- list(c("Surname", "OtherNames"), c("SurnameLab", "OtherNameLab"))
weight(IDparam)   <- 1
weight(NAMEparam) <- 0.5

funlist <- new("epiclass", IDparam, NAMEparam)
@thibautjombart
Copy link

Looks nicer to me, but not sure what the anti S4 brigade will say ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants