Unlike rowMeans()
and rowMedians()
, which give us the calculated figure, mode(x)
gives the storage mode of the data.
My Question - For the following data frame, how can I calculate row wise
Mode?
Data:
Item A B C
Book001 56 32 56
Book002 95 95 20
Book003 50 89 50
Book004 6 65 40
I am reading my worksheet like this:
wk= loadWorkbook (".....xls")
df = readWorksheet (wk, Sheet="Sheet1", header=TRUE)
Try this
install.packages("modeest")
library(modeest)
apply(df[ ,2:length(df)], 1, mfv)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With