I have a data frame. I'm trying to create a dummy variable that is the maximum of 3 columns for a given row.
for(i in 1:nrow(data))
{
data[i,]$max_metric <- max(data[i,]$a,
data[i,]$b,
data[i,]$c)
}
This code works, but it's definitely not the best way to do it. Are there any other ways to do this?