Loading required package: cipheR
Loading required package: pacman
Loading required package: slider
Loading required package: glue
Loading required package: rlang
Attaching package: 'rlang'
The following object is masked from 'package:data.table':
:=
The following objects are masked from 'package:purrr':
%@%, flatten, flatten_chr, flatten_dbl, flatten_int, flatten_lgl,
flatten_raw, invoke, splice
Loading required package: R6
To install `mistlecode` yourself, run `devtools::install_github('guslipkin/mistlecode')`.
Also loading: cipheR data.table dplyr purrr slider stringr tidyverse glue rlang R6
options(scipen = 999)
df <-
read.csv("input.csv") |>
dplyr::mutate(dplyr::across(
tidyselect::matches('child[2-4]C'),
\(x) ifelse(as.character(x) == " ", NA, x)
))
df$child2C[as.character(df$child2C) == " "] <- NA
df$child3C[as.character(df$child3C) == " "] <- NA
df$child4C[as.character(df$child4C) == " "] <- NA