0

I am trying to get the mode from my dataset, this is the code I have entered:

library(modest)
mode(AgeFromFirstDataSet$Age)
mode_age <- mode(AgeFromFirstDataSet$Age)

However I am only being given this back:

[1] "numeric"

On one occasion I was also given the following in red text:

Registered S3 method overwritten by 'htmlwidgets': method from
print.htmlwidget tools:rstudio

[1] "numeric"

I have since got rid of the above message about "Registered S3 method...", but still can not get anything but "numeric" as my mode. I was able to get the mean, median, sd and se without issue, but can only seem to get this answer for the mode. Am I using the wrong code? / What may I be doing wrong that produces numeric for mode, even though I get results for the other four?

I apologise if this seems trivial or poorly explained, but I am very new to R. Thank you.

  • 4
    You are thinking about mode = "Most frequent value" but that is not what the R function mode computes. Take a look at the help file `help(mode)` – G5W Nov 20 '21 at 22:05
  • 4
    See this question on how to find the statistical mode: https://stackoverflow.com/q/2547402/6851825 – Jon Spring Nov 20 '21 at 22:08

0 Answers0