-
Notifications
You must be signed in to change notification settings - Fork 48
/
fill-na.Rd
46 lines (40 loc) · 1.06 KB
/
fill-na.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fill-na.R
\name{fill_na}
\alias{fill_na}
\alias{fill_na.tbl_ts}
\title{Turn implicit missing values into explicit missing values}
\usage{
fill_na(.data, ...)
\method{fill_na}{tbl_ts}(.data, ...)
}
\arguments{
\item{.data}{A \code{tbl_ts}.}
\item{...}{A set of name-value pairs. The values will replace existing explicit
missing values by variable, otherwise \code{NA}.}
}
\description{
Turn implicit missing values into explicit missing values
}
\examples{
tsbl <- as_tsibble(tibble::tibble(
year = year(c(2010, 2011, 2013, 2011, 2012, 2014)),
group = rep(letters[1:2], each = 3),
value = sample(1:10, size = 6),
), group, index = year)
# leave NA as is
fill_na(tsbl)
# replace NA with a specific number
tsbl \%>\%
fill_na(value = 0L)
# replace NA using some functions
tsbl \%>\%
fill_na(value = sum(value, na.rm = TRUE))
# replace NA
pedestrian \%>\%
fill_na(
Date = lubridate::as_date(Date_Time),
Time = lubridate::hour(Date_Time),
Count = median(Count, na.rm = TRUE)
)
}