I want to add a variable (column) to a dataframe, containing in each row the max value of that row across 2nd to 26th column.
For the first row, the code would be:
df$max[1] <- max(df[1,2:26])
I am looking for a way to generalize that for rows 1 to 865. If I give
df$max[1:865] <- max(df[1:865, 2:26])
I get the overall max across all rows for the variable df$max.
Thanks!
Roberto