Skip to content

Commit 833c1f4

Browse files
authored
move exported fun to helpers.R file (#7331)
1 parent 6cfa8b9 commit 833c1f4

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

R/helpers.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# here we have helpers functions that DT exports, on contrary to utils.R file
2+
3+
# convert char to factor retaining order #4837
4+
fctr = function(x, levels=unique(x), ..., sort=FALSE, rev=FALSE) {
5+
if (!isTRUEorFALSE(sort))
6+
stopf("argument 'sort' must be TRUE or FALSE")
7+
if (!isTRUEorFALSE(rev))
8+
stopf("argument 'rev' must be TRUE or FALSE")
9+
if (sort) levels = sort(levels)
10+
if (rev) levels = frev(levels)
11+
factor(x, levels=levels, ...)
12+
}

R/utils.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,6 @@ rss = function() { #5515 #5517
220220
# nocov end
221221
}
222222

223-
# convert char to factor retaining order #4837
224-
fctr = function(x, levels=unique(x), ..., sort=FALSE, rev=FALSE) {
225-
if (!isTRUEorFALSE(sort))
226-
stopf("argument 'sort' must be TRUE or FALSE")
227-
if (!isTRUEorFALSE(rev))
228-
stopf("argument 'rev' must be TRUE or FALSE")
229-
if (sort) levels = sort(levels)
230-
if (rev) levels = frev(levels)
231-
factor(x, levels=levels, ...)
232-
}
233-
234223
formula_vars = function(f, x) { # .formula2varlist is not API and seems to have appeared after R-4.2, #6841
235224
terms <- terms(f)
236225
setNames(

0 commit comments

Comments
 (0)