[R] Writing R package and do.call
Rob Foxall
rfoxall27 at gmail.com
Tue Mar 3 02:46:17 CET 2009
Dear R-Help,
I have written a function, which in simplified format can be represented as:
temp.fn <- function(my.mean,my.sd){
Parameters <- list(mean = my.mean, sd = my.sd)
curve(do.call(dnorm,c(list(x), Parameters)), from = my.mean-my.sd,
to = my.mean+my.sd)
}
This works as I want it do. Wishing to immortalise this function into
my very own package however, results in the following warning:
(Running R CMD check myPackage)
* checking R code for possible problems ... NOTE
temp.fn: no visible binding for global variable 'x'
Although it doesn't seem to matter, I would feel more comfortable if
there was an alternative way which avoided this warning.
( I can avoid the warning, by pointlessly defining x, e.g. "x <- 1",
but this seems pretty ugly!)
Cheers,
Rob.
> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 8.1
year 2008
month 12
day 22
svn rev 47281
language R
version.string R version 2.8.1 (2008-12-22)
More information about the R-help
mailing list