Skip to content

Commit 1ee2f80

Browse files
authored
replace datawizard::data_rename (#474)
* replace datawizard::data_unite and datawizard::data_rename with gsub and setNames * namespace stats::setNames * put back datawizard::data_unite and use alternative trick to match order
1 parent b29eb47 commit 1ee2f80

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

R/report_sample.R

+6-3
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,16 @@ report_sample <- function(data,
181181
unique(groups),
182182
new_column = ".old_names",
183183
separator = "."
184-
)[[".old_names"]]
184+
)[".old_names"]
185+
185186
new_names <- datawizard::data_unite(
186187
unique(groups),
187188
new_column = ".new_names",
188189
separator = ", "
189-
)[[".new_names"]]
190-
result <- datawizard::data_rename(result, pattern = old_names, replacement = new_names)
190+
)[".new_names"]
191+
192+
name_map <- stats::setNames(new_names[[1]], old_names[[1]])
193+
names(result) <- name_map[names(result)]
191194
}
192195
# remember values of first columns
193196
variable <- result[[1]]["Variable"]

0 commit comments

Comments
 (0)