[R] Data Package Query
rolf.turner at xtra.co.nz
Fri Jun 28 00:29:21 CEST 2013
On 28/06/13 04:47, Jeff Newmiller wrote:
> A common error by beginners (which may or may not be your problem in this case) is to create a variable called "data". Unfortunately this hides the function named "data" and from that time forward that R session doesn't work when you type example code that uses the data function.
This is simply not true. I believe it *used* to be true, sometime
but hasn't been true for years. The R language is much cleverer now.
is a function "melvin()" somewhere on the search path and also a data object
"melvin" (earlier on the search path) then doing
will correctly call the function melvin() with no complaints. The R
"can tell" by the parentheses that you mean the *function* melvin and
data object "melvin".
data <- 42
Error: object 'akima' not found
data(akima) # No error message, nor nothin'!
# The data set "akima" is displayed.
All that being said it is ***BAD PRACTICE***, just in terms of
and avoiding confusion, to give a data set set the same name as a function
(either built in, or one of your own).
More information about the R-help