I have this chunk of code in an R script, and what it does is that from a data frame (that has say 4 columns) finds and counts for each row the column with the maximal value. But when in a row there are ties (say two or maybe three max values), the code below just considers the first one (does not count the other ones). Is there in R any way to count the columns with max value even when there are multiple max values (ties?) in rows.
m_0 <- read.csv(file="Tests/myResults", head=FALSE, sep=",")
varb_m0 <- c(m0$ V4)
#create dataframe
myDataFrame <- data.frame(mode_0=varb_m0)
#find max
result <- apply(myDataFrame,1,which.max)
#factor it
result <- factor(result)
#print result
names(myDataFrame)[result]
summary(result)