File:Rerrorbar.svg
Jump to navigation
Jump to search
Size of this PNG preview of this SVG file: 609 × 328 pixels. Other resolution: 2,560 × 1,379 pixels.
Original file (SVG file, nominally 609 × 328 pixels, file size: 75 KB)
Summary
library(ggplot2) df <- ToothGrowth df$dosef <- as.factor(df$dose) library(dplyr) df.summary <- df %>% group_by(dosef) %>% summarise( sd = sd(len, na.rm = TRUE), len = mean(len) ) df.summary p1 <- ggplot(df, aes(dosef, len)) + geom_jitter(position = position_jitter(0.2, seed=1), color = "darkgray") + geom_point(aes(x=dosef, y=len), shape="+", size=8, data=df.summary) + geom_errorbar(aes(ymin = len-sd, ymax = len+sd), width=.2, data = df.summary) df.summary$dose <- as.numeric(df.summary$dosef) p2 <- ggplot(df, aes(dosef, len)) + geom_jitter(position = position_jitter(0.2, seed=1), color = "darkgray") + geom_segment(aes(x=dose-.05, y=len, xend=dose+.05, yend=len), data=df.summary) + geom_errorbar(aes(ymin = len-sd, ymax = len+sd), width=.2, data = df.summary) library(patchwork) p1+p2+plot_layout(guides = "collect")
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 19:37, 24 March 2022 | 609 × 328 (75 KB) | Brb (talk | contribs) | <pre> library(ggplot2) df <- ToothGrowth df$dosef <- as.factor(df$dose) library(dplyr) df.summary <- df %>% group_by(dosef) %>% summarise( sd = sd(len, na.rm = TRUE), len = mean(len) ) df.summary p1 <- ggplot(df, aes(dosef, len)) + geom_jitter(position = position_jitter(0.2, seed=1), color = "darkgray") + geom_point(aes(x=dosef, y=len), shape="+", size=8, data=df.summary) + geom_errorbar(aes(ymin = len-sd, ymax = len+sd), width=.2, data = df.summary) df.summary$dose <... |
You cannot overwrite this file.
File usage
There are no pages that use this file.