Convert string columns in dataframes to R factors