Learn R Programming

SciencesPo (version 1.02.12)

NAto0: Changes NAs in a vector into a given value

Description

Changes NAs in a vector into a given value

Usage

NAto0(x, value = 0)

Arguments

x
the vector
value
the value to be given to the missing value NA.

encoding

UTF-8

See Also

rand.imput.

Examples

Run this code
v <- sample(c(round(runif(5, 1, 3)), rep(NA, 2)))
NAto0(v)

Run the code above in your browser using DataLab