Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions R/buildMatrix.r
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,7 @@ build.x <- function(formula, data, contrasts=TRUE, sparse=FALSE)
{
# convert to factor
# data[, charIndex] <- plyr::catcolwise(as.factor)(data[, charIndex, drop=FALSE])
if(utils::packageVersion('dplyr') <= '0.5.0')
{
data <- dplyr::mutate_at(data, .cols=charIndex, as.factor)
} else if(utils::packageVersion('dplyr') >= '0.6.0')
{
data <- dplyr::mutate_at(data, .vars=charIndex, as.factor)
}
data <- dplyr::mutate(data, dplyr::across(dplyr::all_of(charIndex), as.factor))
## now all factors or characters are at least factors (and nothing extraneous was done) and only the appropriate columns will be put into the contrasts argument
}

Expand Down
3 changes: 1 addition & 2 deletions R/impute.r
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ simple.impute.default <- function(x, fun=median, ...)
#'
simple.impute.data.frame <- function(x, fun=stats::median, ...)
{
. <- NULL
dplyr::mutate_at(x, .cols=names(x), .funs=~simple.impute(., fun=fun))
dplyr::mutate(x, dplyr::across(dplyr::everything(), ~simple.impute(.x, fun=fun)))
}

#' @title simple.impute.tbl_df
Expand Down