In basic R, this is how I apply a function to multiple columns at once, using data.table :
d <- data.table(V1 = rep(1:2, 4:3), V2 = c(1, 2, 4, 5, 2, 3, 4), V3 = 1:7, V4 = sample(letters, 7))
Cols <- c("V2", "V3")
d[, (Cols) := lapply(.SD, function(x) x * 100), .SDcols = Cols]
But now, I'm trying to replicate the same on a SparkDataFrame, in Azure Databricks with SparkR.
I looked on the side of dapply, ..., of spark.lapply, but I can't figure out how to apply a same function to several columns of a SparkDataFrame.