How to find mean and standard deviation from frequency table in R? (2024)

To find the mean and standard deviation from frequency table, we would need to apply the formula for mean and standard deviation for frequency data. For example, if we have a data frame called df that contains a column x for units and frequency for counts then the mean and standard deviation can be calculated as −

Mean = sum(df$x*df$frequency)/sum(df$frequency)SD = sqrt(sum((df$x−Mean)**2*df$frequency)/(sum(df$frequency)−1)) respectively.

Example1

Live Demo

x<−rpois(20,5)frequency<−sample(1:100,20)df1<−data.frame(x,frequency)df1

Output

x frequency1 6 42 7 263 1 864 2 65 4 526 4 617 1 558 4 239 8 3810 3 4011 8 5412 10 5613 7 7414 9 7015 7 5916 16 9517 4 2018 5 919 4 8220 9 45

Example

Mean=sum(df1$x*df1$frequency)/sum(df1$frequency)Mean

Output

[1] 6.55288

Example

SD=sqrt(sum((df1$x−Mean)**2*df1$frequency)/(sum(df1$frequency)−1))SD

Output

[1] 4.172396

Example2

Live Demo

y<−rnorm(20,25,3.24)frequency<−rpois(20,10)df2<−data.frame(y,frequency)df2

Output

y frequency1 27.44960 72 25.80343 53 22.64088 84 22.39061 75 24.55087 76 24.41826 167 23.24647 118 25.61511 99 22.42244 1110 26.77522 1411 21.89209 1112 22.95852 813 25.79808 1614 22.39654 615 21.20728 1216 28.25911 1717 26.67983 818 25.24964 1219 20.92070 820 28.25806 7

Example

Mean=sum(df2$y*df2$frequency)/sum(df2$frequency)Mean

Output

[1] 24.58724

Example

SD=sqrt(sum((df2$y−Mean)**2*df2$frequency)/(sum(df2$frequency)−1))SD

Output

[1] 2.284964

Updated on: 09-Feb-2021

4K+ Views

Related Articles

Kickstart Your Career

Get certified by completing the course

Get Started

How to find mean and standard deviation from frequency table in R? (31)

Advertisem*nts

How to find mean and standard deviation from frequency table in R? (2024)
Top Articles
Treating Firefly Toxicosis in Lizards
Appropriate High School Graduation Gift From Grandparents (2023)
一亩三分地 录取
Skyblock Ah History
Wnem Radar
Amerideck Motorcycle Lift Cost
Incredibox Deluxe
Ray Romano Made a Movie for Sports Parents Everywhere
Weather On October 15
Brett Cooper Wikifeet
Morgandavis_24
Tyrones Unblocked Games Basketball Stars
Dragon's Dogma Duskmoon Tower
11 Best Sites Like The Chive For Funny Pictures and Memes
Gay Black Scat
Was bedeutet "x doubt"?
Registrar Utd
Methstreams Boxing Stream
Teen Movie Night at Kimball Junction (Percy Jackson and the Lightning Thief)
Splunk Append Search
Japan’s Dagashi Treats: A Tasty Trip Down Memory Lane – Umami bites
Brianna Aerial Forum
Wac 182
Gargoyle Name Generator
Charmingtranny Com
Ebony Pyt Twerk
Names of the dead: September 11, 2001
Ups Access Point Location Georgetown Photos
Nephi Veterinarian
Ekaterina Lisina Wiki
Dell Optiplex 7010 Drivers Download and Update for Windows 10
Dayinew
Jvid Rina Sauce
Amerikaanse dollar bestellen | USD kopen
Core Relief Texas
Shaw Funeral Home Vici Oklahoma
Sarah Colman-Livengood Park Raytown Photos
Language levels - Dutch B1 / 2 –What do these language levels mean? - Learn Dutch Online
Shiawassee County 911 Active Events
Pat's Atchafalaya Club Schedule
Dallas College Radiology Packet
2Nd Chance Apartments In Richmond Va
Rg353M Vs Rg351Mp
Ice Quartz Osrs
Craigslist Ct Bridgeport
Viewfinder Mangabuddy
Infinity Pool Showtimes Near Maya Cinemas Bakersfield
Nike.kronos/Wfm/Login
50 Shades Of Grey Movie 123Movies
18K Gersc Stamped Inside Ring
Diora Thothub
When His Eyes Opened Chapter 3002
Latest Posts
Article information

Author: Roderick King

Last Updated:

Views: 6239

Rating: 4 / 5 (71 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Roderick King

Birthday: 1997-10-09

Address: 3782 Madge Knoll, East Dudley, MA 63913

Phone: +2521695290067

Job: Customer Sales Coordinator

Hobby: Gunsmithing, Embroidery, Parkour, Kitesurfing, Rock climbing, Sand art, Beekeeping

Introduction: My name is Roderick King, I am a cute, splendid, excited, perfect, gentle, funny, vivacious person who loves writing and wants to share my knowledge and understanding with you.