R/trim.R

trim = function(x)
{
    # Removes whitespace at the beginning and end of strings
    # Assigning to x[] to retain the original dimensions, rownames and colnames
    x[] = gsub(" +$", "", x)
    x[] = gsub("^ +", "", x)
    x
}

Try the data.table package in your browser

Any scripts or data that you put into this service are public.

data.table documentation built on May 2, 2019, 4:57 p.m.