How to Create Correlation Plots in R

Поділитися
Вставка
  • Опубліковано 7 вер 2024

КОМЕНТАРІ • 76

  • @TheDataDigest
    @TheDataDigest  4 дні тому +1

    If you want to download the R-code to this video you can do this here in my free skool community:
    www.skool.com/data-analysis-with-r-6607/classroom/daa88316?md=e32411294ee7464d90d07527746fb9dc

  • @TaraGhimite
    @TaraGhimite Рік тому +1

    Thank you Sir for the excellent explanation, I believe now, I will be able to learn and I have a hope. Please keep upload more videos

    • @TheDataDigest
      @TheDataDigest  Рік тому

      Hi Tara, thank you for leaving such a nice and encouraging comment. I am planning many more uploads and hopefully get to some in the next weeks. Until then :)

  • @umagenetics3975
    @umagenetics3975 Рік тому +1

    @0.38 sec, i liked the video and subscribed your channel. very easy to get information

    • @TheDataDigest
      @TheDataDigest  Рік тому +1

      Glad to have you as a subscriber. Sorry I haven't uploaded much lately, but that will change next week :)

  • @tajamulislamshah8494
    @tajamulislamshah8494 2 роки тому +2

    You are doing great service. I am loving your videos. Kindly keep uploading more videos on R. Also, create a video to show multivariates in single graph.

    • @TheDataDigest
      @TheDataDigest  2 роки тому +1

      Thank you for this encouraging comment. I keep track of all the requests and suggestions and will hopefully be able to fulfill some wishes of my subscribers. Luckily I am interested in a wide range of R-related topics so there will be videos covering many things in the future.

    • @zahkiani2581
      @zahkiani2581 9 місяців тому

      @@TheDataDigest Hello is it possible to give me R code for drawing coreplot?

  • @SaharCH-xz3lc
    @SaharCH-xz3lc 9 днів тому

    Very well described

  • @pipertripp
    @pipertripp 7 місяців тому +1

    for getting help you can also put the cursor on the function you want to know more about and hit the F1 key.

    • @TheDataDigest
      @TheDataDigest  7 місяців тому +1

      Thanks for the tip! F1 is usually the help in many programs but I never tried it out in RStudio.

  • @AlexisMelo
    @AlexisMelo 2 роки тому +2

    Thanks again for another awesome video!
    Big fan in here!

    • @TheDataDigest
      @TheDataDigest  2 роки тому

      My pleasure :)
      I hope I will gather more fans in the future that look forward to weekly new content. But great to hear I have at least one already.

  • @mikkimooh
    @mikkimooh Рік тому +1

    wow this was so helpful and perfect for my needs. Thank you for your effort!

    • @TheDataDigest
      @TheDataDigest  Рік тому

      Glad you liked it and left such a nice comment.

    • @Hassan_MM.
      @Hassan_MM. Рік тому

      ​@TheDataDigest Please ,Show Correlation of Random Variables at Levels & at first Differences❤

  • @vineethavs9260
    @vineethavs9260 Місяць тому +1

    Life saver. Thank you sir..

    • @TheDataDigest
      @TheDataDigest  15 днів тому

      You are welcome. Let me know if I can help you with anything else. For what data are you using the correlation plots if I may ask?

  • @munkhdulamotgonbayar9923
    @munkhdulamotgonbayar9923 2 роки тому +1

    Great. Thank you very much for sharing this useful tutorial.

    • @TheDataDigest
      @TheDataDigest  2 роки тому

      Thanks for leaving such a nice comment. Glad it helped :)

  •  2 роки тому +1

    This is very useful, I'm sure I'll use this. Thanks!

    • @TheDataDigest
      @TheDataDigest  2 роки тому +1

      Thanks and I agree. It is a quick way to look for relationships between the variables. Some of the functions are quite powerful in doing hierarchical clustering already.

  • @naumanejaz8861
    @naumanejaz8861 2 роки тому +1

    This is a great video I just love your videos.Great job

    • @TheDataDigest
      @TheDataDigest  2 роки тому

      Hi, thanks for the kind comment. Just the encouragement I needed to upload new video after a six week long break.

  • @patrickdiradio
    @patrickdiradio Рік тому +1

    it was very helpfull.. thank you so much

  • @sintubmb
    @sintubmb 2 роки тому +1

    Superb video

  • @wildlifeireland9514
    @wildlifeireland9514 4 місяці тому +1

    Brilliant detail

    • @TheDataDigest
      @TheDataDigest  4 місяці тому +1

      Thanks. It is my best performing video so far. Maybe I should make one about ggpairs which is also a good first visualization package.

    • @wildlifeireland9514
      @wildlifeireland9514 4 місяці тому

      Absolutely, if it's not too much hassle....they're of great help

  • @pinakikkkm
    @pinakikkkm Рік тому +1

    Helped a Lot. Thank you.

    • @TheDataDigest
      @TheDataDigest  Рік тому

      Glad to hear that and thanks for letting me know in a comment :)

  • @sawersoft
    @sawersoft Рік тому

    Excellent! Wonderfull explanation! Thank you very much!

  • @stevennye5075
    @stevennye5075 Рік тому

    excellent overview!

  • @jeffgoblue
    @jeffgoblue Рік тому +2

    Great video!
    How do you reverse/flip the color scale in the corrplot package? I prefer to have negative correlation blue and positive correlations red. Sort of a temperature/ cold-and-hot mentality. Thanks!

  • @Geology_monster
    @Geology_monster 3 місяці тому +1

    bro i love u

    • @TheDataDigest
      @TheDataDigest  Місяць тому

      Alright man :D If you want to discuss data analysis or R specific problems you could join my free community on skool (www.skool.com/data-analysis-with-r-6607/about). You would be one of the early members to join.

  • @XXTargaryenXX
    @XXTargaryenXX 2 місяці тому

    Fantastic! It helped a lot

    • @TheDataDigest
      @TheDataDigest  15 днів тому

      Great to hear, and thanks for leaving a comment. What data sets are you working on these days? Let me know if you need any help with R programming.

  • @rwaewae
    @rwaewae 2 роки тому +1

    Great, thanx

  • @rgonzalezz
    @rgonzalezz Рік тому +1

    Hello! thanks for you video, may i ask for a little help... when i call the function ggcorr the console print Error in ggcorr, could not found the function "ggcorr"

    • @TheDataDigest
      @TheDataDigest  Рік тому

      The ggcorr function is part of the GGally package. Did you make sure to install and load it first?
      install.packages("GGally"); library(GGally)

  • @nasimsadra1595
    @nasimsadra1595 Рік тому

    this was amazing! thank you

  • @renanarruda9855
    @renanarruda9855 2 роки тому +1

    Great! This video is really helpful. Is possible include *** for the significance level in corrplot package?

    • @TheDataDigest
      @TheDataDigest  2 роки тому +2

      Hi Renan, yes it is. The help function and examples are actually quite good for this function.
      Try: ?corrplot() or help(corrplot) and then scroll down to this section:
      It shows you many examples that you can customize on how to adding p-values and stars etc.
      data(mtcars)
      M = cor(mtcars)
      ##the input matrix is not square
      testRes = cor.mtest(mtcars, conf.level = 0.95)
      ## specialized the insignificant value according to the significant level
      corrplot(M, p.mat = testRes$p, sig.level = 0.05, order = 'hclust', addrect = 2)
      ## leave blank on no significant coefficient
      corrplot(M, p.mat = testRes$p, method = 'circle', type = 'lower', insig ='blank',
      addCoef.col ='black', number.cex = 0.8, order = 'AOE', diag = FALSE)
      ## add p-values on no significant coefficients
      corrplot(M, p.mat = testRes$p, insig = 'p-value')
      ## add all p-values
      corrplot(M, p.mat = testRes$p, insig = 'p-value', sig.level = -1)
      ## add significant level stars
      corrplot(M, p.mat = testRes$p, method = 'color', diag = FALSE, type = 'upper',
      sig.level = c(0.001, 0.01, 0.05), pch.cex = 0.9,
      insig = 'label_sig', pch.col = 'grey20', order = 'AOE')

    • @renanarruda9855
      @renanarruda9855 2 роки тому

      @@TheDataDigest Lot of thanks!

  • @korman9872
    @korman9872 Рік тому +1

    Wow tx sir

    • @TheDataDigest
      @TheDataDigest  Рік тому

      No problem. I am glad you watch my videos.

  • @rifathossain9272
    @rifathossain9272 Рік тому

    In the following code, how can I change the default color? I have tried using color brewer palette where only histograms colors are being changed but scatterplot color remain unchanged. How can I change default color for everything including labels & scatterplots?
    GGally::ggpairs(iris, columns = 1:4,
    ggplot2::aes(colour=species))

  • @scenarios911
    @scenarios911 Рік тому +1

    Hello, it's a nice video, can you please tell us how to plot few variables correlation species, actually i got the plot but that is mixed, among variables. I want few variables on one side and species another side. Is it possible? if yes, then kindly suggests us some information about it. Thank you.

    • @TheDataDigest
      @TheDataDigest  Рік тому

      Hi Muhammad Farooq, unfortunately I don't understand the question completely.
      Can you give me a time stamp to where in the video your question relates to?
      If you mean species from the iris dataset then this does not really have a correlation to variables, as it is a category with only 3 levels.
      However I post code below to show you how to only show correlation between a few selected variables (maybe that is what you asked about):
      corr_matrix

    • @scenarios911
      @scenarios911 Рік тому +1

      @@TheDataDigest Wow, that's worked sir, i am really grateful to you, thanks once again. Hats off to you..

    • @TheDataDigest
      @TheDataDigest  Рік тому

      @@scenarios911 Glad it worked and was what you were looking for. I think I should have included such in example in the video as another subscriber emailed me with a similar request.
      Anyway, thanks for leaving such a polite comment and letting me know my answer helped. It is always very rewarding to see the extra effort being useful to my subscribers.

  • @mohammedadjeli6849
    @mohammedadjeli6849 2 роки тому +1

    thanks for this video. I have a problem whith #adding species information and color#, this step didn't work for me when I executeö
    GGally::ggpairs(iris, columns = 1:4,
    ggplot2::aes(colour=species))
    this message appears:
    plot: [1,1] [==>-----------------------------------------------] 6% est: 0s Error in FUN(X[[i]], ...) : object 'species' not found
    Can you help me please

    • @TheDataDigest
      @TheDataDigest  2 роки тому

      Of course I can help you. When I copy your code I get the same error. Unfortunately you made a tiny mistake that is usually really hard to find. The error message tells you that it cannot find "species" in the iris data. Because in iris it is written with a capital-S. When you change species to Species it runs fine. Don't be discourage, these typos happen very often.

    • @mohammedadjeli6849
      @mohammedadjeli6849 2 роки тому

      @@TheDataDigest thanks a lot for your help
      can you give me how to interpret this diagram (iris)

  • @findthetruth3021
    @findthetruth3021 2 роки тому +1

    Can you make a video on Flexdashboard and how to add filters to the dashboard to create full interactivity? For instance, I filter on a specific item then the whole dashboard will be reflected on it.

    • @TheDataDigest
      @TheDataDigest  2 роки тому +1

      More interactive graphs, dashboards and shinyApps are definitely on my list of topics I want to cover. I am not sure when I will get there but I keep track of your request and thank you for the comment.

    • @findthetruth3021
      @findthetruth3021 2 роки тому +1

      @@TheDataDigest Yes, please. Flexdashboard is also really awesome if you can make a video on it as well and applying filter on the dashboard as I mentioned before. That would be awesome. But please tech us in an easy way like to use your Dashboard as a template just changing the data source. Thanks in advance, much appreciated 👏👏👏

    • @TheDataDigest
      @TheDataDigest  2 роки тому +1

      @@findthetruth3021 I will definitely create something on that topic this year :) Maybe here is already something that fits your needs: pkgs.rstudio.com/flexdashboard/articles/examples.html
      In the top right corner you get the source code an can try to adjust it accordingly.

  • @sheikhrashid3574
    @sheikhrashid3574 2 роки тому +1

    could you please make a video on how to save output results in PDF file.

    • @TheDataDigest
      @TheDataDigest  2 роки тому

      Excellent request Rashid and quite a coincidence because another guy just asked about options to save images as png file. My next video is already planned and will be published soon, but after that I will make a video on how to save charts as png or pdf.
      What you can do for now is simply create your chart and in RStudio select the Export option in your Plots panel. Save as PDF should be an option to chose. Use the preview button to check whether the height and width looks good and save as file.

    • @sheikhrashid3574
      @sheikhrashid3574 2 роки тому

      @@TheDataDigest Thank you for your Response. Actually , i want to know how to save output results in PDF.

  • @rwaewae
    @rwaewae 2 роки тому +1

    Hi, can we plot summary statistics and correlation plot in single diagram.? thanx

    • @TheDataDigest
      @TheDataDigest  2 роки тому +1

      Hi, I recommend looking into the patchwork package. In this video I combined many charts into one plot (ua-cam.com/video/FzntrJ8l5as/v-deo.html).
      Also in the 30DayChartChallenge (twitter.com/DigestData) you find many examples of multiple charts in one plot.

    • @rwaewae
      @rwaewae 2 роки тому

      @@TheDataDigest THANX. I will try.

  • @zahkiani2581
    @zahkiani2581 9 місяців тому

    Hello, can you help me in this soft ware? I want to drag a coreplot

    • @TheDataDigest
      @TheDataDigest  9 місяців тому

      Hi, do you need the R-code from the video or do you have a specific request to help with your data?
      You can send questions directly to: question[at]thedatadigest[dot]email

    • @zahkiani2581
      @zahkiani2581 9 місяців тому

      @@TheDataDigest thanks for your response, yes I want code for corep analysis and drawing the figures in R software, can i put my question to the email address that you sent?

  • @meliheser01
    @meliheser01 2 роки тому

    If i want to create correlation between two variables. How should I do it?

    • @TheDataDigest
      @TheDataDigest  2 роки тому +1

      Try: cor.test(x=data$variable1, y=data$variable2), or did you mean plotting them?

    • @meliheser01
      @meliheser01 2 роки тому

      @@TheDataDigest i meant plotting them

    • @TheDataDigest
      @TheDataDigest  2 роки тому

      @@meliheser01 I suggest looking into geom_point() for scatterplots [ua-cam.com/video/sk59wjdmrd8/v-deo.html], you can also add geom_smooth(method='lm', formula= y~x))

  • @ayesharukhsar5122
    @ayesharukhsar5122 7 місяців тому

    How I apply this script on my data set

    • @TheDataDigest
      @TheDataDigest  15 днів тому

      Come in my skool community and share the code and script and I can help you out. Or you email me with your specific problem.

  • @el-houssainebahouar4269
    @el-houssainebahouar4269 2 роки тому

    I thank you very much for this very rich tutorial, but when I tried to apply it to my data I receive this message which I do not understand because I am still a beginner if you can help me and thank you once again:
    GGally::ggpairs(log,columns = 1:13,ggplot2::aes(colours=Season))
    plot: [1,2] [=>---------------------------------------- -------------------------------------------------- -------------------------------------------------- -] 1% is:14s Error in cor.test.default(x, y, method = method, use = use):
    not enough finite observations

    • @TheDataDigest
      @TheDataDigest  2 роки тому

      Sorry to hear that, but errors are common and should not discourage you. What I recommend is to post a reproducible example with a small dataset and R-code that produced the error at: www.stackoverflow.com
      Feel free to post the link here and I can answer on their website.