Transforming selected dataframe columns to factor-type (or any other type transformation in principle). Taking advantage of dataframe in R considered as a list of columns. Note however lapply applied to a dataframe by itself would have returned a list not a dataframe.