rbitrary icon indicating copy to clipboard operation
rbitrary copied to clipboard

why you cannot rm(iris)

Open pedroconcejero opened this issue 9 years ago • 2 comments

iris is a tortured dataset approaching a century of age. Why can't you rm it?

(or some other datasets like attitude)

attitude rm(attitude) iris rm(iris)

pedroconcejero avatar Mar 16 '16 11:03 pedroconcejero

In both cases because they're inbuilt datasets; for the same reason you can rm() a user-defined function but not rm, say, as.data.frame.

This shouldn't actually be a cost; these datasets aren't loaded until you call them.

Ironholds avatar Mar 16 '16 12:03 Ironholds

More fun: the following works (but doesn’t actually get rid of iris);

iris = iris
rm(iris)

(The first line assigns a new variable in the current environment, from where it’s deleted in the second line.)

klmr avatar Mar 28 '16 21:03 klmr