[Solved] how do you apply a function to all of the columns in data frame? [closed]


Based on your description:

data2[] <- lapply(data2, function(x) vapply(x, paste, collapse = ", ", character(1L)))

Or

data2[] <- lapply(data2, function(x) vapply(x, toString, character(1L)))

2

solved how do you apply a function to all of the columns in data frame? [closed]