add_value: Manually change values in data.frames

View source: R/add_to.R

add_valueR Documentation

Manually change values in data.frames

Description

Manually change values in data.frames

Usage

add_value(x, row, col, value = NA)

Arguments

x

data.fram to be canged.

row

which row or which condition sex == "male"

col

which column

value

the value to be changed

Value

data.frame

Examples


DF <- data.frame(
pat.id = 1:5,
sex = factor(c("male", NA, "female", "male", "female")),
hight = c(170, 178, 185, 169, 10)
)

add_value(DF, 5, 3, NA)
add_value(DF, pat.id == 2, sex, "female")
add_value(DF, hight < 100, hight, 175)


stp4/stp25tools documentation built on Feb. 27, 2025, 11:14 p.m.