Calculate Mean of Data Frame Column in R (6 Examples) | mean, summarise of dplyr, colMeans & na.rm

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024

Комментарии • 45

  • @j-beryl15
    @j-beryl15 2 года назад +2

    I invested too many hours watching R videos with 'hundred-thousands views' and alas, your video solved my puzzle. Thank you

  • @juanvega6027
    @juanvega6027 Год назад +1

    I just recently discovered your channel and I have to say, I love the content. I've learned a lot because you explain everything in detail and go through examples. You have my subscription lol I hope to continue learning more from you!!

    • @matthias.statisticsglobe
      @matthias.statisticsglobe Год назад +1

      Hi Juan! Thanks for the amazing comment, great to hear that our channel is that helpful for you! We try our best to keep it up that way;) If you have any questions/suggestions, please let us know!

  • @bmh4248
    @bmh4248 3 года назад +2

    Thanks a lot for your content !!!! You are helping a lot of data professionals and data students.

    • @StatisticsGlobe
      @StatisticsGlobe  3 года назад

      Glad you think so mate! Thanks a lot for the kind words :)

  • @Adeyeye_seyison
    @Adeyeye_seyison Год назад +1

    Thanks a million sir,
    For the effort,time invested and the VALUE you are ADDING to us!

    • @matthias.statisticsglobe
      @matthias.statisticsglobe Год назад

      You are very welcome, Seyison! Thanks for the motivating words and your support!

  • @shivamshinde9810
    @shivamshinde9810 3 года назад +1

    This is pretty good even for revision of learned concepts...

  • @dominiquebarrette9621
    @dominiquebarrette9621 2 года назад +2

    Thank you for your videos they are so helpful and you teach so well however in my data frame, my rows have 5 treatments and in each treatment, I have 3 results - how can I calculate the mean per treatment without having to separate each treatment - thank you and best regards

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      Thank you so much for the wonderful feedback Dominique! You can calculate the mean by group as shown here: statisticsglobe.com/mean-by-group-in-r

  • @andreitomescu7847
    @andreitomescu7847 2 года назад +1

    Thanks for the video

  • @sabaamir5304
    @sabaamir5304 Год назад +1

    thanks for your tutorials. I watched several of them but am still unsure how to calculate the mean for specific levels of different factors. for example, I want the mean of reaction_time for task A (in the factor task which is a column in data just the participants who did A ), and for correct trials(there is another factor called to answer and I want only the correct one to be calculated not wrongs). I would appreciate you introducing a function.

    • @cansustatisticsglobe
      @cansustatisticsglobe Год назад +1

      Hello Saba,
      You can use the group_by() function to implement statistical operations by the factor levels. See our tutorial: statisticsglobe.com/mean-by-group-in-r
      Regards,
      Cansu

  • @larissacury7714
    @larissacury7714 2 года назад +2

    Thank you very much! However, what if I need to calculate the mean of two collumns like this:
    (Same task, two teachers)
    Teacher 1 Teacher 2 MEAN
    5 6 5.5
    6 7 6.5
    7 8 7.5

  • @michaelelias85x65
    @michaelelias85x65 2 года назад +1

    Tank you ..

  • @ElDominator1
    @ElDominator1 Год назад +1

    Hello! Thanks for the video. I have a dataset with just 4 rows which I want to average, but across thousands of columns. Is there a way to simultaneously average all rows under each column, so that I have just one row of means under my thousands of columns?

    • @cansustatisticsglobe
      @cansustatisticsglobe Год назад

      Hello,
      I think you can use the following code to implement it.
      data

  • @lorenzkarl175
    @lorenzkarl175 2 года назад +1

    I would have a question. What if i want to calculate several means within one column.
    For example i have following dataset:
    Colour Number
    Black 2
    Black 4
    Brown 6
    Brown 3
    Black 6
    Brown 3
    And i want to calculate the mean for Black and for Brown.
    Thx in advance!

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      Hey Lorenz, please have a look at this tutorial: statisticsglobe.com/mean-by-group-in-r Regards, Joachim

    • @lorenzkarl175
      @lorenzkarl175 2 года назад +1

      @@StatisticsGlobe You are amazing Joachim! Thx a lot

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      You are very welcome Lorenz, glad it helped! :)

  • @zakjay6748
    @zakjay6748 2 года назад +1

    what if I want to calculate mean of particular item from the column "word" in 2 different conditions, for example
    cond word rt
    A 8 10
    B 8 19

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      Hey Zak, I'm not sure if I understand your question correctly. Could you illustrate the desired result of your example data?

  • @alestamegayat4342
    @alestamegayat4342 2 года назад +1

    Why dont you show how to exclude few columns and take the means of the rest seperately? And other thing is getting the mean of only numerics. And the laat thing is combinjng the two?

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      Hey Alesta, I have plenty of other tutorials that can be combined with this one. For instance:
      statisticsglobe.com/extract-certain-columns-of-data-frame-in-r
      statisticsglobe.com/select-only-numeric-columns-from-data-frame-in-r
      Regards, Joachim

  • @arthygunam5685
    @arthygunam5685 2 года назад +1

    How to calculate the mean of selected column ?
    I have 5 columns but I want the mean of last 3 columns

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад +1

      Hey Arthy, please try this: colMeans(data[ , (ncol(data) - 2):ncol(data)])

    • @arthygunam5685
      @arthygunam5685 2 года назад +1

      @@StatisticsGlobe thankyou very much sir

    • @StatisticsGlobe
      @StatisticsGlobe  2 года назад

      You are very welcome Arthy!

  • @danishrizwan8251
    @danishrizwan8251 10 месяцев назад +3

    If I go to heaven, I will take you with me!

  • @Hassan_MM.
    @Hassan_MM. Год назад

    Wanna Create Only Deviations from Mean for Entire Column❓️

    • @cansustatisticsglobe
      @cansustatisticsglobe Год назад +1

      Hello Hassan,
      Do you want to calculate the differences from the mean for each entry in a column?
      Best,
      Cansu

    • @Hassan_MM.
      @Hassan_MM. Год назад +1

      @cansustatisticsglobe Yes ✔️,Exactly for few Columns only,then will Square those values for Entire column to do away with Negative Sign if any,Kindly Help How its Done ❓️

    • @cansustatisticsglobe
      @cansustatisticsglobe Год назад

      Hello @@Hassan_MM.,
      I think you can simply implement this:
      # Example data frame
      df

    • @Hassan_MM.
      @Hassan_MM. Год назад +1

      @@cansustatisticsglobe That's Works Magic 💯♥️ Thanks✔️

    • @cansustatisticsglobe
      @cansustatisticsglobe Год назад +1

      Perfect! Welcome @@Hassan_MM..