Last active
February 5, 2025 07:37
-
-
Save Kiri-Zhang/ce302188f7d73735342f760d0ec83254 to your computer and use it in GitHub Desktop.
[Basic Calculate] #R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(plyr) | |
librart(rio) | |
rl <- import ("clipboard", header = T) | |
rrl <- ddply(rl, c('name'), summarise , mean = mean(fw) , n = length (fw), sd = sd(fw), se = sd/sqrt(n)) | |
#line | |
ggplot (trl, aes(x = day, y = mean, group = group , color = group)) + | |
geom_line(linewidth = 1) + | |
geom_point(size = 2)+ | |
geom_errorbar(aes(ymax = mean+se, ymin = mean-se), width = .1 , linewidth = 1) + | |
theme (panel.background = element_rect(fill= "white"), | |
axis.line = element_line(color = "black"), | |
axis.title = element_blank()) | |
#bar | |
ggplot (rfw, aes(x = as.factor(name), y = mean)) + | |
geom_bar(stat = 'identity' , position = 'dodge') + | |
geom_errorbar(aes(ymax = mean+se, ymin = mean-se), width = .1 , linewidth = 1) + | |
theme (panel.background = element_rect(fill= "white"), | |
axis.line = element_line(color = "black"), | |
axis.title = element_blank()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment