I have test dataset that i want to graph:
Week M
50 0.082474227
50 0.100694444
50 0.079037801
50 0.090277778
50 0.083333333
50 0.097222222
50 0.09375
50 0.104166667
12 0.079861111
12 0.104166667
12 0.09375
12 0.090277778
80 0.079861111
80 0.128472222
80 0.052083333
80 0.09375
80 0.120274914
80 0.118055556
80 0.121527778
80 0.097222222
80 0.069444444
80 0.145833333
80 0.065972222
80 0.045138889
80 0.083333333
80 0.079861111
80 0.092783505
80 0.113402062
80 0.090277778
80 0.134020619
80 0.118055556
I want to graph the data based on the mean values of 'week12','week50' and 'week80' with error bars, and size the dots based on the sample sizes.
first i need to make a summary statistics of the dataset:
SEsum <- summarySE(data, measurevar="M", groupvars="Week")
next i want to plot the graph:
ggplot(SEsum, aes(x=Week, y=M)) +
geom_errorbar(aes(ymin=M-se, ymax=M+se), width=3) +
geom_line() +
geom_point(aes(size= N))+
scale_x_continuous(breaks=c(12,50,80), labels=c("Wk12", "Wk50", "Wk80"))
everything looks good except that i would like to customize the range of the sample sizes it uses to graph the dot sizes.
In the graph that's where the legend says N is set to '4', '8', '12' and '16'. In the code that would be the part where it says 'geom_point(aes(size= N))', i want the minimum sample size to be 1 and maximum to be 50, and if possible, use only 3 choices (the plot here gives 4 choices) because there are only 3 time points.
the reason for that is i need to graph 26 such graphs with 26 different data sets with different sample sizes, and i would like to standardize the range so when i put all of the graphs side by side, it will be easy to compare.