Skip to content
Prev 382913 / 398502 Next

find multiple mode, sorry for not providing enough information

Hi Jim,

Yes, you are right.  I sorted the tem4$Var1 first, then find rising peaks in Freq variable from left to right.   I guess I probably need to define the minimal rising and drop on both side of a potential maxima, so avoid identifying really small rising peaks.  For example, I only want to identify the freq value of freq=10 (corresponding var1 = allele6), freq=8(var1=allele9),, freq=8( var1=allele12), and freq=149 (var1=allele23),  but ignore freq=4 (var10=allele15) and freq=2 (var1=allele18).

I am still working on it, any help would be really appreciated.

Thank you,

Ding

-----Original Message-----
From: Jim Lemon [mailto:drjimlemon at gmail.com] 
Sent: Monday, March 16, 2020 1:10 AM
To: Yuan Chun Ding; r-help mailing list
Subject: Re: [R] find multiple mode, sorry for not providing enough information

[Attention: This email came from an external source. Do not open attachments or click on links from unknown senders or unexpected emails.]

----------------------------------------------------------------------
Hi Ding,
While I was completely off the track in my first reply, the subsequent posts make your problem somewhat clearer. The way you state the problem suggests that the order of the values of "freq" is important.
That is, it is not just a matter of finding local maxima, but the direction in which you approach those maxima is important. For example. I might want to only identify maxima with at least four monotonically increasing values preceding them and a decrease of at least half the value of the maximum in the succeeding value. By breaking down the problem into a set of criteria, these can be implemented in a function that will search the values in one direction, returning the locations of maxima that fulfil those criteria.

Jim
On Mon, Mar 16, 2020 at 3:11 PM Yuan Chun Ding <ycding at coh.org> wrote:
----------------------------------------------------------------------
------------------------------------------------------------
-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 receive 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)
------------------------------------------------------------