SlideShare a Scribd company logo
Replacing Missing Values
With mean
Sarith Divakar M
Research Scholar, CUSAT
sarith@cusat.ac.in
Sample DataSet
X id y time sec
1 1 1 1
2 1 2 6 1
3 1 2 12
4 1 2 24 1
5 2 1 1
6 2 2 6
7 2 2 12 1
8 2 1 24 1
9 3 0 1
10 3 2 6 1
11 3 2 12 1
12 3 2 24
13 4 1 1
Import DataSet in R Studio
Imported DataSet- NA for missing Values
Replaced time with mean of the column
Detailed Steps
1. Read DataSet
samplehousing <- read.csv("~/Desktop/samplehousing.csv")
2. View DataSet
view(samplehousing)
3. Replace missing values in time column with mean
samplehousing$time[is.na(samplehousing$time)] <- mean(samplehousing$time, na.rm = TRUE)
4. Replace missing values in time column with mean
samplehousing$sec[is.na(samplehousing$sec)] <- mean(samplehousing$sec, na.rm = TRUE)
References
• DataSet:
https://vincentarelbundock.github.io/Rdatasets/datasets.html

More Related Content

Similar to Replacing missing values with mean in R (10)

PDF
Managing missing values in routinely reported data: One approach from the Dem...
removed_62798267384a091db5c693ad7f1cc5ac
 
PDF
Missing data handling
QuantUniversity
 
PDF
SPSS GuideAssessing Normality, Handling Missing Data, and Calculating Total S...
ahmedragab433449
 
PDF
Data wrangling week 9
Ferdin Joe John Joseph PhD
 
PPTX
Interpolation Missing values.pptx
RushikeshGore18
 
DOC
data Sreening.doc
murtaza5500
 
PDF
SPSS GuideAssessing Normality, Handling Missing Data, and Calculating Scores...
ahmedragab433449
 
PDF
Data Preparation- handling missing value
Rupak Roy
 
PPTX
Dealing with incomplete data for mapping and spatial analysis
Aileen Buckley
 
PPTX
Pwf-ujpynbnffffffffffffffffffffffffffffffffandas2.pptx
Pluto62
 
Managing missing values in routinely reported data: One approach from the Dem...
removed_62798267384a091db5c693ad7f1cc5ac
 
Missing data handling
QuantUniversity
 
SPSS GuideAssessing Normality, Handling Missing Data, and Calculating Total S...
ahmedragab433449
 
Data wrangling week 9
Ferdin Joe John Joseph PhD
 
Interpolation Missing values.pptx
RushikeshGore18
 
data Sreening.doc
murtaza5500
 
SPSS GuideAssessing Normality, Handling Missing Data, and Calculating Scores...
ahmedragab433449
 
Data Preparation- handling missing value
Rupak Roy
 
Dealing with incomplete data for mapping and spatial analysis
Aileen Buckley
 
Pwf-ujpynbnffffffffffffffffffffffffffffffffandas2.pptx
Pluto62
 

Recently uploaded (20)

PDF
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
PPTX
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
PPTX
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
PPT on the Development of Education in the Victorian England
Beena E S
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PPTX
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PPTX
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPT on the Development of Education in the Victorian England
Beena E S
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
community health nursing question paper 2.pdf
Prince kumar
 
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
Ad

Replacing missing values with mean in R