Using stat_summary from ggplot2 to add a statistics layer to plots in R (CC089)

  Рет қаралды 13,230

Riffomonas Project

Riffomonas Project

Күн бұрын

Пікірлер: 40
@Riffomonas
@Riffomonas 3 жыл бұрын
Is there a stat_* function that you'd like to learn more about?
@venkatpgi
@venkatpgi 3 жыл бұрын
Hi, wonderful and very educative videos. Can you pls let know is there is any way to connect the points with lines within the stat_summary function?
@Riffomonas
@Riffomonas 3 жыл бұрын
@@venkatpgi try using geom="line" in stat_summary
@venkatpgi
@venkatpgi 3 жыл бұрын
@@Riffomonas My data is to look time trend (x-axis has time) and Y axis is a score measured on multiple individuals at each time point. Using stat_summary I could calculate mean score at each time point and its CI. Now I wish to connect the point representing mean at each time point so that the trend is more clear to the reader. Adding geom = "line" is not working on my case. Can you help?
@Riffomonas
@Riffomonas 3 жыл бұрын
You’ll probably want two stat summary functions. One to get the means and another to connect the means. You can also always create a separate data frame with rhe means and add those data with separate geoms
@leonardofwink
@leonardofwink 2 жыл бұрын
could you please make a video about changing boxplots defaults ranges? i didnt find any documentation understandable enough yet :( i've been looking for something like min/%30/median/%80/max thank you so much for all your videos :D
@ratral
@ratral 3 жыл бұрын
Thanks, as always, each video teaches me something new and motivates me to explore more about it.
@Riffomonas
@Riffomonas 3 жыл бұрын
Awesome! That’s the best compliment you can give me 😊
@niceday2015
@niceday2015 2 жыл бұрын
Wow, it's super great to learn that from you. Thanks a lot!
@Riffomonas
@Riffomonas 2 жыл бұрын
Cool stuff - right?
@danielvaulot5105
@danielvaulot5105 3 жыл бұрын
Very nice, I did not know hwo powerful the stat_* functions were ....
@Riffomonas
@Riffomonas 3 жыл бұрын
They're my new favorite thing :)
@ciroweinstein8627
@ciroweinstein8627 2 жыл бұрын
Thank you, wish i started looking at your videos earlier ... Really cool stuff Its been helping out a lot
@Riffomonas
@Riffomonas 2 жыл бұрын
Glad to hear it! I'm glad you're finding them helpful 🤓
@guzman_uy9420
@guzman_uy9420 2 жыл бұрын
Great! thanks. But how could we get the letters of the Tukey test above the bars? I mean, ready for publication charts
@Riffomonas
@Riffomonas 2 жыл бұрын
Keep watching 🤓 there’s a couple of episodes on that
@afonsoosorio2099
@afonsoosorio2099 Жыл бұрын
Great tutorial, informative and high-quality. Could you kindly tell me what .groups="drop" is doing at the end of the code block where you are grouping (group_by) and computing the summary statistics? Are you ungrouping? Thank you.
@tomaszuspienski4833
@tomaszuspienski4833 Жыл бұрын
The answer is in the previous video (CC088). It's removing a comment above the table
@yujiangsun5428
@yujiangsun5428 2 жыл бұрын
thank you! very informative, love it
@Riffomonas
@Riffomonas 2 жыл бұрын
🤓
@Jcakiiiii
@Jcakiiiii 2 жыл бұрын
This is great thank you so much!!!!
@Riffomonas
@Riffomonas 2 жыл бұрын
My pleasure!
@santiagodevillalobos9654
@santiagodevillalobos9654 2 жыл бұрын
is there a way to graph the difference between two bars (fun=diff) but that at the same time is based in the absolute valour of the difference?
@Riffomonas
@Riffomonas 2 жыл бұрын
You can write your own function here using whatever functions you want.
@andyserowitz5370
@andyserowitz5370 3 жыл бұрын
Why do you use fun.data as an argument in stat_summary when others use fun.y or fun .x? Please help me understand when and why you’d use either. Thanks.
@Riffomonas
@Riffomonas 3 жыл бұрын
Hi Andy - thanks for watching! fun.data takes a function that outputs the y, ymin, and ymax values. fun.y takes a function that outputs the y value. There’s also a fun.ymin and fun.ymax values to get you the same kind of thing. I guess which you use depends on the type of data you want out and what functions you’re using to summarize the data
@andyserowitz5370
@andyserowitz5370 3 жыл бұрын
@@Riffomonas I think I understand now. I’ll play with the code some more.
@CristinaCampbell
@CristinaCampbell 2 жыл бұрын
How do I get means of the max? I have hourly data for several dataloggers collecting temperature data. I'd like to get daily temp maximums by the month and then means for the maxes. If I : group_by (day, type) %>% summarise (mean=mean(temp)) then I realize I'm getting means (the average of all the temps). However, if I do summarise (max=max(temp)) I feel like I'm getting 1 observation (the maximum of the observations). So how to average the maximums? Hope this is clear. Thx
@Riffomonas
@Riffomonas 2 жыл бұрын
Hi Cristina - I'd probably do something like one summarize to get the max and then another summarize to get the mean. Of course, for each summarize you need to make sure you have the right grouping variables
@CristinaCampbell
@CristinaCampbell 2 жыл бұрын
@@Riffomonas Thanks for the reply, I'll try that. Yep, I've noticed I'm getting a little confused with all the ways I can group (day, sensors, months, habitat, time) and how that changes the outcome. Anyway, I'll mess around with my code.
@puttipongchunark7178
@puttipongchunark7178 2 жыл бұрын
How to export a summary data from stat_summary to a dataframe? Please help!!!
@Riffomonas
@Riffomonas 2 жыл бұрын
You would need to do a separate group_by/summarize pipeline to get out the summary data you want
@puttipongchunark7178
@puttipongchunark7178 2 жыл бұрын
@@Riffomonas Thank you
@rishikeshdash12
@rishikeshdash12 2 жыл бұрын
Sir, I have plotted a Slope plot on 4 time points. Each time point has 10 samples. I want to add a median line which will connect each time point and I want to add error bars in each time point which will show inter quartile range of that point. Sir, I have tried fun.data and fun inside stat_summary but failed to add errorbars and median line. I think manipulating aesthetics inside stat_summary it is possible don't know how to do it. If you help me I will be always grateful to you😇.
@Riffomonas
@Riffomonas 2 жыл бұрын
Sorry but I really don’t have the ability to do one on one help for free and it’ll be a while before I come back to this type of content
@rishikeshdash12
@rishikeshdash12 2 жыл бұрын
@@Riffomonas Ok sir but one of your video give me idea to add that Median Line and IQR errorbar. I use same method I.e. used for Putting centroid in PCoA Plot. 😁😍🤩
@sitendugoswami1990
@sitendugoswami1990 3 жыл бұрын
Are we supposed to ignore the oscar?
@Riffomonas
@Riffomonas 3 жыл бұрын
Hahaha! It's not *really* an Oscar :) A friend sent that to me as a token of our friendship. I include it in the video so he knows I appreciate our friendship
@puspitalestarikhanna8582
@puspitalestarikhanna8582 Жыл бұрын
Hi! Can I ask, how to show data "sd" if the result is "NA"? I tried this syntax -> sd(df$x, na.rm = TRUE), but that didn't work, please share if you know the solution :)
Creating a barplot with error bars using ggplot2 (CC088)
22:18
Riffomonas Project
Рет қаралды 12 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 26 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 26 МЛН
小路飞和小丑也太帅了#家庭#搞笑 #funny #小丑 #cosplay
00:13
家庭搞笑日记
Рет қаралды 17 МЛН
Creating a labeled scatter plot in R with ggplot2 (CC157)
17:14
Riffomonas Project
Рет қаралды 7 М.
Boxplots in R with ggplot and geom_boxplot() [R- Graph Gallery Tutorial]
16:17
Box-Plots with Statistical Details - all you need to know
18:06
yuzaR Data Science
Рет қаралды 4,9 М.
Describe and Summarise your data
19:44
R Programming 101
Рет қаралды 57 М.
Creating a stacked barchart in R with ggplot2 (CC102)
22:19
Riffomonas Project
Рет қаралды 34 М.
Advanced ggplot    (episode #1)
13:44
R Programming 101
Рет қаралды 16 М.