fill_na: Fill NA with the last no-NA value generic.

Description Usage Arguments Value See Also Examples

View source: R/fill_na.R

Description

This method can apply to numeric vector, data.frame/tibble. grouped_df. If you want to apply to data.frame/tibble, please library(dplyr).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
fill_na(x, ...)

## Default S3 method:
fill_na(x, ...)

## S3 method for class 'tbl_df'
fill_na(x, ...)

## S3 method for class 'data.frame'
fill_na(x, ...)

Arguments

x

a data.frame or a vector

...

col names character vector or just bare name.

Value

data.frame or a vector

See Also

fill group_by

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
x <- c(1, NA, NA, 2, 3)
y <- c(NA, NA, 1, NA, 3)
xy <- data.frame(x,y)
fill_na(x)
fill_na(y)
## Not run: 
# require(dplyr)
fill_na(xy, x, y)
fill_na(xy, c("x","y"))
fill_na(xy, starts_with("x"))

## End(Not run)

xiaojunlin/myfunc documentation built on Nov. 17, 2020, 4:02 a.m.