
Convert IOP Measurements
convert_iop.RdThis function converts intraocular pressure (IOP) measurements by replacing "无" with NA and converting the rest to numeric.
Examples
# Simulated IOP data,含单位与缺失写法
iop_df <- tibble::tibble(
id = 1:6,
iop_od = c("15","无","18mmHg",">30","-","N/A"),
iop_os = c("16","未测","14.5","12mmHg","NA","20")
)
convert_iop(iop_df, c("iop_od","iop_os"))
#> # A tibble: 6 × 3
#> id iop_od iop_os
#> <int> <dbl> <dbl>
#> 1 1 15 16
#> 2 2 NA NA
#> 3 3 18 14.5
#> 4 4 30 12
#> 5 5 NA NA
#> 6 6 NA 20