Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Jul 30, 2022
1 parent 791dbe5 commit c8a8959
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 73 deletions.
7 changes: 6 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
linters: with_defaults(object_name_linter = NULL, object_usage_linter = NULL, line_length_linter(180), cyclocomp_linter = cyclocomp_linter(20), seq_linter = NULL)
linters: with_defaults(object_name_linter = NULL,
object_length_linter(40),
commented_code_linter = NULL,
object_usage_linter = NULL,
line_length_linter(120),
cyclocomp_linter = cyclocomp_linter(20))
10 changes: 5 additions & 5 deletions R/data_reshape.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ data_to_long <- function(data,
...,
cols,
colnames_to) {

if (!missing(colnames_to)) {
.is_deprecated("colnames_to", "names_to")
if (is.null(names_to)) {
Expand Down Expand Up @@ -133,8 +132,9 @@ data_to_long <- function(data,
if (any(names_to %in% setdiff(names(data), cols))) {
stop(insight::format_message(
"Some values of the columns specified in 'names_to' are already present as column names.",
paste0("Either use another value in `names_to` or rename the following columns: ",
text_concatenate(names_to[which(names_to %in% setdiff(names(data), cols))])
paste0(
"Either use another value in `names_to` or rename the following columns: ",
text_concatenate(names_to[which(names_to %in% setdiff(names(data), cols))])
)
), call. = FALSE)
}
Expand Down Expand Up @@ -184,8 +184,8 @@ data_to_long <- function(data,
if (is.null(names_pattern)) {
new_vals <- unlist(lapply(
strsplit(unique(long[[names_to_2]]), names_sep, fixed = TRUE),
function(x) x[i])
)
function(x) x[i]
))
long[[names_to[i]]] <- new_vals
} else {
tmp <- regmatches(
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-data_reshape.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ test_that("data_to_long: arg 'cols' overrides 'select'", {
rows_to = "Participant"
)
)

})


Expand Down
Loading

0 comments on commit c8a8959

Please sign in to comment.