I have a dataframe df
like this:
I want to add a new column which shows the name of the max value among 5 variables. For example, for the first row: the max value is 5, the name of max value is Olfactory
. Similarly repeat for other rows. The expected dataframe should be:
My code is:
find_max<-apply(across(.cols=c(12:16),MARGIN=1), FUN=max)
Error: `across()` must only be used inside dplyr verbs.
Is there idea to fix this error? thank you in advance!