[R-pkg-devel] Referring to data in R/sysdata.rda
Hadley Wickham
h.wickham at gmail.com
Sat Apr 15 18:24:18 CEST 2017
Just ignore it.
Hadley
On Friday, April 14, 2017, Roy Mendelssohn - NOAA Federal <
roy.mendelssohn at noaa.gov> wrote:
> 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 <javascript:;> 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.
>
> ______________________________________________
> R-package-devel at r-project.org <javascript:;> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
--
http://hadley.nz
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list