[R-pkg-devel] Referring to data in R/sysdata.rda

Roy Mendelssohn - NOAA Federal roy.mendelssohn at noaa.gov
Sat Apr 15 02:15:11 CEST 2017


In my package I have a dataframe that I use but want to hide from the user.  In Hadley's book on R Packages,  he says:

> 	• If you want to store parsed data, but not make it available to the user, put it in R/sysdata.rda. This is the best place to put data that your functions need.
> 

I have done that,  and sure enough when the package is loaded, the structure is there.  However,  when I am working on debugging code, and I refer to the  structure in a function,  RStudio gives a warning that the structure is out of scope, say the data frame is myDF:

myFunc  <-  function(myIndex) {
     junk  <-  myDF[index]
    return(junk)
}

RStudio will warn that myDF is out of scope.  My question is if there is a proper way to refer to myDF so as not to get the warning,  or just ignore it.  Basically before submission I try to remove all warnings from the editor,  even style ones,  just to have things cleaner.

Thanks,

-Roy





**********************
**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new street address***
110 McAllister Way
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: Roy.Mendelssohn at noaa.gov www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.



More information about the R-package-devel mailing list