intermingle.cbind: input validation, row-name alignment, safe subsetting, loop fix, docs - #38
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c79fe148e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Could you please address and validate the following issue? And if you agree with it, please fix it. "Problem: intermingle.cbind() treats equal row counts as proof that every df1 row name exists in df2, so the result can contain missing df2 values or fail during matrix subsetting instead of returning matched rows. Trigger: df1 and df2 have the same number of rows but different row-name sets. Fix: use the intersection path whenever the row-name sets differ, or reject unequal sets before reordering." |
Co-authored-by: vertesy <5101911+vertesy@users.noreply.github.com>
Addressed in |
Motivation
intermingle.cbind()so inputs are validated, rows are matched by name (not position), and column iteration/subsetting is safe to avoid accidental dimension drops.Description
stopifnot()that asserts(is.data.frame(df1) || is.matrix(df1)),(is.data.frame(df2) || is.matrix(df2)), non-nullrownames(df1)andrownames(df2), andncol(df1) == ncol(df2).df1anddf2to theintersect(rownames(df2), rownames(df1))usingdrop = FALSEto preserve dimensions.df2torownames(df1)withdf2 <- df2[CommonGenes, , drop = FALSE]so rows are combined by name, not by position.for (x in 1:(2 * length(df1)))withfor (x in seq_len(2L * ncol(df1))), update the roxygen@returnto state a matrix is returned, regenerateman/intermingle.cbind.Rd, and bumpDevelopment/config.Rversion to2.8.1.Testing
git diff --checkwhich reported no issues and usedgit diff --statto inspect changes; commit created successfully.Rscript -e 'roxygen2::roxygenise(load_code = roxygen2::load_source)'butRscriptis not available in the environment so automated doc generation failed.man/intermingle.cbind.Rdwas updated manually to match the new@returntext and committed.git status --shortand inspected the diffs before committing.Codex Task