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

Flipping misc organisation to address #107 #168

Merged
merged 6 commits into from
Dec 23, 2023

Conversation

gregorgorjanc
Copy link
Contributor

@gregorgorjanc gregorgorjanc commented Dec 22, 2023

Here is an implementation where we flip misc organisation from ind-node to node-ind for simplicity and speed of operations. As discussed in #107.

Looking forward to feedback;)

@gregorgorjanc
Copy link
Contributor Author

The last commit is just an exploration of how this new org would work if we use Pop or MultiPop in misc

Added length method to MultiPop, but isn't working
@gaynorr
Copy link
Owner

gaynorr commented Dec 23, 2023

The family pulled me away, so I just pushed something that is incomplete. I tried to add a length method to MultiPop, but it isn't working. Also, the mergePop is failing in the tests inside the testthat tests.

@gregorgorjanc
Copy link
Contributor Author

Yes, the test is unfinished because I wasn't sure/clear if we want to handle Pop or MultiPop in the new misc organisation. I initiated three cases:

  pop@misc$mtP = popOrig
  pop@misc$mtLP = list(popOrig, popOrig)
  pop@misc$mtMP = multiPop

Note that pop@misc$mtLP (list of Pop) is effectively the same as pop@misc$mtMP (MultiPop) and I think this is how we should move onwards - working with these options.

I was not sure if you wanted to have support for pop@misc$mtP (Pop) as well, but this is a less natural use case (subsetting the misc that contains pop as one of the misc-list-nodes would pick individuals of the population), though we can make it work by developing a length(method) for Pop too (making it the same to nInd()), I think.

@gregorgorjanc
Copy link
Contributor Author

I have just tested the length() method on MultiPop and it works as expected!

> length(multiPop)
[1] 2

@gregorgorjanc
Copy link
Contributor Author

This last push makes all the tests run. There is just one test commented out since we cannot create an empty MultiPop. Might add that later in another issue/PR - #169

@gaynorr
Copy link
Owner

gaynorr commented Dec 23, 2023

I think I know how to fix this. It should just be a matter of changing the validity function for MultiPop. It's currently a loop with 1:length(object@pops). This fails when length is 0. I should instead be using seq_along(length(object@pops)), because it works when the value is zero. This is a best practice for R programming that I didn't know about until relatively recently.

@gaynorr gaynorr merged commit 69c3038 into gaynorr:devel Dec 23, 2023
@gregorgorjanc gregorgorjanc deleted the devel-different_misc_order branch January 17, 2024 17:55
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