Skip to content
Back to formatted view

Raw Message

Message-ID: <4F7F59F4.5050207@fhcrc.org>
Date: 2012-04-06T21:02:44Z
From: Hervé Pagès
Subject: R CMD check returns NOTE about package data set as global variable
In-Reply-To: <027098F6-E168-469F-B5A8-D3667EC39A63@gmail.com>

On 04/06/2012 01:33 PM, peter dalgaard wrote:
>
> On Apr 6, 2012, at 22:23 , Herv? Pag?s wrote:
>
>> On 04/06/2012 12:33 PM, Brad McNeney wrote:
>>> OK, thanks for the tip on good coding practice. I'm still getting the NOTE though when I make the suggested change.
>>
>> Because when you do return(RutgersMapB36[,1]), the code checker has no
>> way to know that the RutgersMapB36 variable is actually defined.
>>
>> Try this:
>>
>> test<-function() {
>>    RutgersMapB36<- NULL
>>    data(RutgersMapB36)
>>    return(RutgersMapB36[,1])
>> }
>>
>
> That might remove the NOTE, but as far as I can see, it also breaks the code...
>

oops, right...

This should remove the NOTE and work (hopefully):

test<-function() {
    data("RutgersMapB36")  # loads RutgersMapB36 in .GlobalEnv
    RutgersMapB36 <- get("RutgersMapB36", envir=.GlobalEnv)
    return(RutgersMapB36[,1])
}

Cheers,
H.


-- 
Herv? Pag?s

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319