Skip to content

Commit

Permalink
modify error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Aug 28, 2024
1 parent 6a851aa commit df613b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/data_modify.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ data_modify.data.frame <- function(data, ..., .if = NULL, .at = NULL, .modify =

# error for data frames with no rows...
if (nrow(data) == 0) {
insight::format_error("`data_modify()` only works for data frames with at least one row.")
insight::format_error("`data` is an empty data frame. `data_modify()` only works for data frames with at least one row.") # nolint
}

# check if we have dots, or only at/modify ----
Expand Down Expand Up @@ -212,7 +212,7 @@ data_modify.grouped_df <- function(data, ..., .if = NULL, .at = NULL, .modify =

# error for data frames with no rows...
if (nrow(data) == 0) {
insight::format_error("`data_modify()` only works for data frames with at least one row.")
insight::format_error("`data` is an empty data frame. `data_modify()` only works for data frames with at least one row.") # nolint
}

grps <- attr(data, "groups", exact = TRUE)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-data_modify.R
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ test_that("data_modify errors for empty data frames", {
x <- mtcars[1, ]
expect_error(
data_modify(x[-1, ], new_var = 5),
regex = "only works"
regex = "empty data frame"
)
})

Expand Down

0 comments on commit df613b8

Please sign in to comment.