[R] find multiple mode

Abby Spurdle @purd|e@@ @end|ng |rom gm@||@com
Sun Mar 15 23:42:37 CET 2020


I think people have misinterpreted the question.
The OP wants local maxima from the series.

The original series is frequencies, so your table is frequencies of frequencies.

A solution can be derived by looking at signs of the first and second
differences.
But there may be a simpler way????

On Mon, Mar 16, 2020 at 10:24 AM Jim Lemon <drjimlemon using gmail.com> wrote:
>
> Hi Ding,
> Translating this into R code:
>
> freq<-c(1,2,5,5,10,4,4,8,1,1,8,8,2,4,3,1,2,1,1,138,149,14,1,1)
> > table(freq)
> freq
>  1   2   3   4   5   8  10  14 138 149
>  8   3   1   3   2   3   1   1   1   1
> > library(prettyR)
> > Mode(freq)
> [1] "1"
>
> You have a single modal value (1). If there were at most two ones, you
> would have three values (2,4,8) that could be considered multiple
> modes. What you seem to be doing is considering values that are not
> separated by commas as modes. Perhaps this is a formatting problem
> with your email.
>
> Jim
>
> On Mon, Mar 16, 2020 at 7:55 AM Yuan Chun Ding <ycding using coh.org> wrote:
> >
> > Hi R users,
> >
> > I want to find multiple modes (10, 8, 149) for the following vector.
> >
> > freq =1,2,5,5  10,4,4,8,1,1,8,8,2,4,3,1,2,1,1 138 149  14,1,1;
> >
> > any suggestion?
> >
> > Thank you,
> >
> > Ding
> >
> > ----------------------------------------------------------------------
> > ------------------------------------------------------------
> > -SECURITY/CONFIDENTIALITY WARNING-
> >
> > This message and any attachments are intended solely for the individual or entity to which they are addressed. This communication may contain information that is privileged, confidential, or exempt from disclosure under applicable law (e.g., personal health information, research data, financial information). Because this e-mail has been sent without encryption, individuals other than the intended recipient may be able to view the information, forward it to others or tamper with the information without the knowledge or consent of the sender. If you are not the intended recipient, or the employee or person responsible for delivering the message to the intended recipient, any dissemination, distribution or copying of the communication is strictly prohibited. If you received the communication in error, please notify the sender immediately by replying to this message and deleting the message and any accompanying files from your system. If, due to the security risks, you do not wish to r
>  ec
> >  eive further communications via e-mail, please reply to this message and inform the sender that you do not wish to receive further e-mail from the sender. (LCP301)
> > ------------------------------------------------------------
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list