Learn R Programming

psHarmonize (version 0.3.6)

range_function: Range function. To be called by harmonization function.

Description

Range function. To be called by harmonization function.

Usage

range_function(
  data = temp_dataset,
  min_max_range = possible_range,
  new_var = item
)

Value

Returns a list with the new vector (values outside of range set to NA), and the number of values set to NA.

Arguments

data

Data to be modified

min_max_range

Range of allowed values

new_var

New variable

Examples

Run this code

test_data <- data.frame(val = 1:10)

range_function(data = test_data, min_max_range = '[2,8]', new_var = 'val')

Run the code above in your browser using DataLab