1

Is there a way to plot summary statistics in ggplot2 without the raw data? Say I have three data points: the first has mean 34.2 and standard error 3.4, the second has mean 28.6 and standard error 0.5, and the third has mean 44.0 and standard error 2.2. How would I plot this?

1 Answer 1

3

There may be more efficient ways, but you could try putting those numbers into a data frame and plotting from that. So you'd have observations 1 - 3, and their corresponding means and standard errors in three columns as follows:

    obs <- c(1,2,3)
    mean <- c(34.2, 28.6, 44.0)
    se <- c(3.4, 0.5, 2.2)
    df = data.frame(obs, mean, se)

    ggplot(df, aes(y=mean, x=obs)) + 
       geom_bar(position="dodge", stat="identity") + 
       geom_errorbar(aes(ymax = mean+se, ymin = mean-se))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.