Learn R Programming

useful (version 1.2.6)

constant: constant

Description

Helper function for imputing constants

Usage

constant(n = 1)

Value

A function that when used simply returns n.

Arguments

n

The value to return

Author

Jared P. Lander

Details

Returns a function that always returns the value of n.

Examples

Run this code
constant(4)(1:10)

theDF <- data.frame(A=1:10, B=1:10, C=1:10)
theDF[c(1, 4, 6), c(1)] <- NA
theDF[c(3, 4, 8), c(3)] <- NA
simple.impute(theDF, constant(4))

Run the code above in your browser using DataLab