[R-meta] R-meta] add comma to numbers in forest plot from metaprop objet

Zoukal Sofia @o||@c@p @end|ng |rom gm@||@com
Fri Dec 1 12:44:29 CET 2023


*Hi,
**I need to modify the numbers in the columns of a forest plot made
from a metaprop object.*

*Please how can **I** add commas for numbers w**ith 5 or more digits
in **column** of event and total to appear in the forest plot?*

*#there is my data:*

events <- c(12000, 5000, 800, 30000)  # Example event counts

n <- c(50000, 10000, 5000, 40000)  # Example total sample sizes
data <- data.frame( events = events, n = n)

# Format event counts with commas for numbers with 5 or more digits
formatted_events <- ifelse(events >= 10000, format(events,
big.mark=","), as.character(events))
data$events_formatted <- formatIfNeeded(data$events)
print(data)

# Run meta-analysis with the modified dataset
meta_result <- metaprop(event = formatted_events, n = n)

# Plot the forest plot for the meta-analysis with formatted data

forest(meta_result)


Unfortunatlly, it does not work: "Error: Non-numeric value for argument 'event'"

help me please!

Best

ᐧ

	[[alternative HTML version deleted]]



More information about the R-sig-meta-analysis mailing list