Skip to content

Combine mrs#8

Open
persephonet wants to merge 14 commits intoCrunch-io:masterfrom
persephonet:combineMRs
Open

Combine mrs#8
persephonet wants to merge 14 commits intoCrunch-io:masterfrom
persephonet:combineMRs

Conversation

@persephonet
Copy link
Contributor

I haven't made tests for combineArrays but to be honest I'm not sure anyone else would ever want/need that function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to eliminate this space and run make doc again. I suspect this is why you don't have an entry in your NAMESPACE file for these functions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete these 6 lines. The three lines below do this more robustly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read the tests for this correctly, the purpose of this function is to take the subvariables from two or more MR variables and make a single MR from them--is that right? If so, how about we keep the first MR, unbind the rest, and use addSubvariables to add them to the first? Like:

combineMRs <- function (variable, ...) {
    newsubvars <- unlist(lapply(list(...), unbind)) ## unbind returns the URLs of the unbound variables
    return(addSubvariables(variable, newsubvars))
}

addSubvariables would need to take more than just one subvar, and it would need to accept URLs, but neither are too challenging (and they're more generally useful in that function itself too). And also this way, you wouldn't need separate functions to add to categorical arrays and multiple responses--same function would work.

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

Successfully merging this pull request may close these issues.

2 participants