Does anyone know of a way (creative hack or otherwise) that data from an R package can be utilized inside a function without actually loading it to the environment?
As a simple example:
plot.sepals <- function() {
data(iris);
plot(Sepal.Length ~ Petal.Length, data=iris);
}
You'll notice when you run the example that the iris
dataset gets loaded. This is precisely what I wish to avoid. I'd like to use the data but not have it loaded to an environment.
Thanks for any help or ideas.
I'm still not allowed to comment yet, but I think that @user3293236 answered your question as I understand it.
You mean like this?
plot.sepals <- function() {
plot(Sepal.Length ~ Petal.Length, data=datasets::iris) }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With