Row wise operation in R can be performed using rowwise() function in dplyr package. Dplyr package is provided with rowwise() function with which we will be doing row wise maximum or row wise minimum operations.
We will be using iris data to depict the example of rowwise() function.
library(dplyr) mydata2 <-iris head(mydata2)
iris data will be looking like
We will be creating additional variable row_max using mutate function and rowwise() function to store the row wise maximum variable.
df1 = mydata2 %>% rowwise() %>% mutate(row_max= max(Sepal.Length:Petal.Width)) head(df1)
So the snapshot of resultant data frame will be