Skip to content

Update g_forest() to support col_x and col_ci in the same column. - #1507

Open
wwojciech wants to merge 8 commits into
pharmaverse:mainfrom
wwojciech:1499_g_forest_estCI_single_col
Open

Update g_forest() to support col_x and col_ci in the same column.#1507
wwojciech wants to merge 8 commits into
pharmaverse:mainfrom
wwojciech:1499_g_forest_estCI_single_col

Conversation

@wwojciech

Copy link
Copy Markdown
Contributor

Fixes #1499

@wwojciech

Copy link
Copy Markdown
Contributor Author

Hi @danielinteractive , @gmbecker - Can you pl. review this new PR? Thank you!

@danielinteractive danielinteractive left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @wwojciech please see my question below

Comment thread R/g_forest.R
Comment thread tests/testthat/test-g_forest.R
@wwojciech

Copy link
Copy Markdown
Contributor Author

Thanks @danielinteractive , please see the update code.

@wwojciech

Copy link
Copy Markdown
Contributor Author

Hi @danielinteractive - I had to update the code to ensure backward compatibility, specifically to allow col_x or col_ci to be NULL, hiding x or ci when the point estimate and CI share a column.

If you have a chance, could you please take a look at the updated code?

Comment thread R/g_forest.R
lwr <- upr <- lwr_t <- upr_t <- rep(NA_real_, nrow(tbl_df))
} else {
sym_size <- rep(1, nrow(tbl_df))
lwr <- x_ci[, ncol(x_ci) - 1]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

are we sure here that ncol(x_ci) is >= 2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, we are. If col_ci is not NULL (and nrow(tbl_df) >= 1), lines 284--288 ensure that the CI column has at least two elements. Consequently, lines 301--308 ensure that x_ci has at least two columns.
If nrow(tbl_df) == 0, then x_ci is NULL, so x_ci[, i] is NULL for any index i.

Comment thread R/g_forest.R
sym_size <- rep(1, nrow(tbl_df))
lwr <- x_ci[, ncol(x_ci) - 1]
upr <- x_ci[, ncol(x_ci)]
lwr_t <- x_ci_t[, ncol(x_ci_t) - 1]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same question here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same answer: Yes, we are (x_ci_t is derived directly from x_ci).

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.

[Feature Request]: g_forest() to support point estimates and confidence intervals stored in a single column

2 participants