Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

umx_select_valid

Update NA values in one column with valid entries from another


Description

Merge valid entries from two columns

Usage

umx_select_valid(col1, col2, bothways = FALSE, data)

Arguments

col1

name of the first column

col2

name of the second column

bothways

Whether to replace from 1 to 2 as well as from 2 to 1

data

The dataframe containing the two columns.

Value

  • Updated dataframe

See Also

Examples

tmp = mtcars
tmp$newDisp = tmp$disp
tmp$disp[c(1,3,6)] = NA
anyNA(tmp$disp) # column has NAs
tmp = umx_select_valid("disp", "newDisp", data = tmp)
anyNA(tmp$disp) # column repaired

umx

Structural Equation Modeling and Twin Modeling in R

v4.10.10
GPL-3
Authors
Timothy C. Bates [aut, cre] (<https://orcid.org/0000-0002-1153-9007>), Gillespie Nathan [wit], Michael Zakharin [wit], Brenton Wiernik [ctb], Joshua N. Pritikin [ctb], Michael C. Neale [ctb], Hermine Maes [ctb]
Initial release
2021-11-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.