Code
(expect_error(replace_na(1, 1:10)))
Output
<error/rlang_error>
Error in `replace_na()`:
! Replacement for `data` must be length 1, not length 10.
data
Code
(expect_error(replace_na(x, 1.5)))
Output
<error/vctrs_error_cast_lossy>
Error in `vec_assign()`:
! Can't convert from `replace` <double> to `data` <integer> due to loss of precision.
* Locations: 1
Code
(expect_error(replace_na(df, list(a = 1.5))))
Output
<error/vctrs_error_cast_lossy>
Error in `vec_assign()`:
! Can't convert from `replace$a` <double> to `data$a` <integer> due to loss of precision.
* Locations: 1
Code
replace_na(df, replace = 1)
Condition
Error in `replace_na()`:
! `replace` must be a list, not a number.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.