I'm really new to R but this is really important for my job. I have a sheet of data with 28 columns, and want to create a new one. It needs to show the highest number between the columns 12, 14, 16 and 18. It needs to be specific to each row of course. (I tried the function max on the column but it only shows me one result for the entire sheet and not per row)
Asked
Active
Viewed 49 times
0
-
2Can you provide a reproducible example please? Have a look at https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – MKR Jul 17 '18 at 21:10
-
Try: `df$colMax <- apply(df[, c(12, 14, 16, 18)], 1, max)` – zx8754 Jul 17 '18 at 21:14
-
1It worked, thanks zx8754 – JST Jul 17 '18 at 21:24