I have a function written as:
setlower <- function(df) {
for(j in seq_along(df)){
data.table::set(df, j=j, value=stringi::stri_trans_tolower(df[[j]]))
}
invisible(df)
}
I have a much larger package that calls this function on multiple data.table
's in an lapply
. The profile for it looks like:
You can see I spent a majority of my time for each data.table
I am processing in the setlower
function. Is there anyway to speed this up? I know both data.table
and stringi
are supposed to be about as fast as you can get for data frame
and string
operations but I didn't know if there is a potentially faster way to assure that any given data frame is converted entirely to lower case.