daniel1noble / orchaRd

Extending the Orchard Plot for Meta-analysis
https://daniel1noble.github.io/orchaRd/
11 stars 6 forks source link

can not define the "N" in bubble_plot #58

Closed ecologyxy closed 7 months ago

ecologyxy commented 8 months ago

Describe the bug Hi. I followed the sample code of bubble_plot and rewrite my own code as:

mod_A_CA <- rma.mv(SMD, vSMD, mods = ~ A_CA, random=list(~1 | NID, ~1|ID), control = list(rel.tol = 1e-9), data=overall_SMD)
summary(mod_A_CA, digits = 3)

overall_SMD$n <- rowSums(overall_SMD[, c("B_N_C", "B_N_T")])
orchaRd::bubble_plot(mod_A_CA, mod = "A_CA", group = "NID", xlab = "A_CA", ylab = "SMD", legend.pos = "top.left", N= "n", k = F, g = FALSE)

which "B_N_C"and "B_N_T" were the sample size of control and treatment groups, and this code worked.

and Error reported:

> orchaRd::bubble_plot(mod_A_CA, mod = "A_CA", group = "NID", xlab = "A_CA", ylab = "SMD", legend.pos = "top.left", N= "n", k = F, g = FALSE)
Don't know how to automatically pick scale for object of type <function>. Defaulting to continuous.
Error in `ggplot2::geom_point()`:
! Problem while computing aesthetics.
ℹ Error occurred in the 1st layer.
Caused by error in `compute_aesthetics()`:
! Aesthetics are not valid data columns.
✖ The following aesthetics are invalid:
✖ `size = scale`
ℹ Did you mistype the name of a data column or forget to add `after_stat()`?
Run `rlang::last_trace()` to see where the error occurred.

It should be something wrong with "N= "n"", as all went well if I deleted it.

Screenshots image

Desktop (please complete the following information):

I'm not sure if the differences between my dataset and the example dataset caused this error, could you help me? Thanks

daniel1noble commented 8 months ago

Hmm, not sure. what is the function rowSums returning exactly? Can you coerce that to a numeric string before assigning it as a column in your data?

daniel1noble commented 7 months ago

Given that this looks like a problem with you're data not orchaRd I'm closing this for now