The data
variable is only available on the master, not on the slaves.
Since there also happens to be a function called data
, that is what they try to use,
and subsetting it with [[
gives the error message you get.
Try exporting the data
variable to the other nodes before the computation.
clusterExport(cl, "data")