na2zero2: na2zero2

Description Usage Arguments Examples

View source: R/misc.R

Description

Turn all the NA values in a data frame to zero but only in columns that are numeric or integers. Uses for loops, so may be slow for large data frames.

Usage

1
na2zero2(mydf)

Arguments

mydf

a data frame

Examples

1
2
3
4
5
x1 <- c(5,7,NA,9,10)
x2 <- c(2.4, 7, 6.4, NA,5.2)
x3 <- c(NA, "A", "B", "C", "D")
x <- data.frame(x1,x2,x3)
newdf <- na2zero2(x)

smach/rmiscutils documentation built on Dec. 15, 2021, 1:49 a.m.