nan_replace: Check NaN values in a dataframe and replace them

View source: R/nan_replace.R

nan_replaceR Documentation

Check NaN values in a dataframe and replace them

Description

This function takes a dataframe and checks for NaN values. It also replaces the NaN values if requested, a with user-specified value. This function was partially taken from the following StackOverflow link: https://stackoverflow.com/questions/18142117/how-to-replace-nan-value-with-zero-in-a-huge-data-frame/18143097

Usage

nan_replace(df, replace = TRUE, value = 0)

Arguments

df

Dataframe to be checked for NaN values

replace

Whether to replace NaN values.

value

Value to replace NaN with.

Examples

df <- data.frame(a = c(1, 2), b = c(NaN, 3))
nan_replace(df)


sysilviakim/Kmisc documentation built on Jan. 28, 2023, 10:58 a.m.