Can anyone help me with this?
If I run:
> mode(iris$Species)
[1] "numeric"
> mode(iris$Sepal.Width)
[1] "numeric"
Then I get "numeric" as answer
Cheers
M
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
see
?mode:modeis giving you the storage mode. If you want the value with the maximum count, then use table.Please, read the help files if a function is not doing what you think it should.
Some extra explanation :
max(tmp)is the maximum oftmptmp == max(tmp)gives a logical vector with a length of tmp, indicating whether a value is equal or not to max(tmp).which(tmp == max(tmp))returns the index of the values in the vector that areTRUE. These indices you use to select the value in tmp that is the maximum value.See the help files
?which,?maxand the introductory manuals for R.