From |zm|r||g @end|ng |rom m@||@n|h@gov  Sun Feb  4 16:55:13 2024
From: |zm|r||g @end|ng |rom m@||@n|h@gov (Izmirlian, Grant (NIH/NCI) [E])
Date: Sun, 4 Feb 2024 15:55:13 +0000
Subject: [Rd] NOTE: multiple local function definitions for ?fun? with
 different formal arguments
In-Reply-To: <CA+jjkEbwGe-W-gSfds1=4Vzrf=LOitwiE=4Vx0+NCj4t2t09JA@mail.gmail.com>
References: <5jst8ric3j9fg55fkwuhhlyk.1707061436584@email.android.com>
 <CA+jjkEbwGe-W-gSfds1=4Vzrf=LOitwiE=4Vx0+NCj4t2t09JA@mail.gmail.com>
Message-ID: <lo01v1qa61gmseab9ma660ts.1707061568394@email.android.com>

Well you can see that yeast is exactly weekday you have.  The way out is to just not name the result

toto <- function(mode)
{
    ifelse(mode == 1,
        function(a,b) a*b,
        function(u, v, w) (u + v) / w)
}


________________________________
From: Grant Izmirlian <izmirlidroid at gmail.com>
Date: Sun, Feb 4, 2024, 10:44 AM
To: "Izmirlian, Grant (NIH/NCI) [E]" <izmirlig at mail.nih.gov>
Subject: Fwd: [EXTERNAL] R-devel Digest, Vol 252, Issue 2

Hi,

I just ran into this 'R CMD check' NOTE for the first time:

* checking R code for possible problems ... NOTE
toto: multiple local function definitions for ?fun? with different
  formal arguments

The "offending" code is something like this (simplified from the real code):

toto <- function(mode)
{
    if (mode == 1)
        fun <- function(a, b) a*b
    else
        fun <- function(u, v, w) (u + v) / w
    fun
}

Is that NOTE really intended? Hard to see why this code would be
considered "wrong".

I know it's just a NOTE but still...

Thanks,

H.

--
Herv? Pag?s

Bioconductor Core Team
hpages.on.github at gmail.com<mailto:hpages.on.github at gmail.com>


CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and are confident the content is safe.


	[[alternative HTML version deleted]]



[Rd] NOTE: multiple local function definitions for ?fun? with different formal arguments
Izmirlian, Grant (NIH/NCI