Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

how to interpolate missing data in r with example

library(dplyr)
library(zoo)

#interpolate missing values in 'sales' column
df <- df %>%
        mutate(sales = na.approx(sales))

#view updated data frame
df

   day sales
1    1     3
2    2     6
3    3     8
4    4    10
5    5    14
6    6    17
7    7    20
8    8    23
9    9    26
10  10    29
11  11    32
12  12    35
13  13    39
14  14    44
15  15    49
Source by www.statology.org #
 
PREVIOUS NEXT
Tagged: #interpolate #missing #data
ADD COMMENT
Topic
Name
5+2 =