I’m calling apply(data, 2, function(x) {...}) where data is a matrix. Is there any way for the function to know the name of the column whose values are present in x? Or perhaps there’s another function to accomplish the same task?
I’m calling apply(data, 2, function(x) {…}) where data is a matrix. Is there any
Share
One common way to deal with this is to loop over the column names themselves: