zoonproject / zoon

The zoon R package
Other
61 stars 13 forks source link

Subsetting GetModuleList() #386

Closed Doi90 closed 7 years ago

Doi90 commented 7 years ago

It would be good if we could subset GetModuleList() with an argument rather than sub-setting a saved list. If I want to see just occurrence modules then I need to run this:

tmp <-GetModuleList()
tmp$occurrence

Ideally we could do something like this:

GetModuleList(type = "occurrence")

Makes it neater when using it in the vignettes we're building.

AugustT commented 7 years ago

Sounds like a good idea to me

timcdlucas commented 7 years ago

I certainly tried (and clearly failed) to do this back in the day. GetModuleList downloads the .Rd files. I think the only bit in there that guarantees to identify the module type is

Other process: \code{\link{AddRandomUniformPredictors}},

Does that seem right @AugustT ?

AugustT commented 7 years ago

I was thinking much more simple than that. Put type in at the end

GetModuleList(type = "occurrence"){
    ...
    return(tmp[type])
}

But then I am a lazy coder!

There might be a way to identify all the correct .rd files and then just download them, which would obviously be more efficient. But the .rd files are pretty small at the moment...

timcdlucas commented 7 years ago

Oh right! Forgot GetModuleList does already do the grouping. Yup, your way sounds fine,

goldingn commented 7 years ago

Sounds ace. Want to take a swing at implementing this @doi90?

If so, check out match.arg() for type checking the argument.

Doi90 commented 7 years ago

I'll swing away.

Doi90 commented 7 years ago

Submitted a pull request with the ability to subset by module type. Assuming it passes Travis checks and people are happy with my approach I'll close this issue

goldingn commented 7 years ago

this is in master now