Adds a residual error term (column .error
) to the data frame, drawn from a normal distribution with specified variance.
Examples
df <- tibble::tibble(x = 1:5)
add_error(df, variance = 2)
#> Error in .data %>% dplyr::ungroup() %>% dplyr::mutate(.error = rnorm(n(), sd = sqrt(!!variance))): could not find function "%>%"