Data Package Query
You need to learn to execute one statement at a time in order to debug this yourself. Copy and paste is your friend. Hint: I already told you that the data function is inappropriate if the data does not come from a package.
You should be learning to use the str(), head(), and ls() functions to explore your R in-memory environment, and use the built-in help system with the question mark ("?str") or the help.search() and RSiteSearch() functions.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
Yasmine Refai <y_refai at hotmail.com> wrote:
hello,
please advice what is wrong at the below syntax:
"Trial<-read.table("Trial.txt",header=TRUE)
Trial
save.image(file="Trial.RData")
data(Trial)
fit<-logistf(data=Trial, y~x1+x2)
"
and here is the error I get:
"Warning message:
In data(Trial) : data set ?Trial? not found
"
regards,
yasmine
Date: Fri, 28 Jun 2013 10:29:21 +1200
From: rolf.turner at xtra.co.nz
To: jdnewmil at dcn.davis.ca.us
CC: y_refai at hotmail.com; r-help at r-project.org
Subject: Re: [R] Data Package Query
On 28/06/13 04:47, Jeff Newmiller wrote:
<SNIP>
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.
<SNIP>
This is simply not true. I believe it *used* to be true, sometime
waaaaayyyy back,
but hasn't been true for years. The R language is much cleverer now.
If there is a function "melvin()" somewhere on the search path and also a data
object
"melvin" (earlier on the search path) then doing
melvin(<whatever>)
will correctly call the function melvin() with no complaints. The R
language
"can tell" by the parentheses that you mean the *function* melvin and
not the
data object "melvin".
E.g.
data <- 42
require(akima)
akima
Error: object 'akima' not found
data(akima) # No error message, nor nothin'!
akima
# The data set "akima" is displayed.
All that being said it is ***BAD PRACTICE***, just in terms of
comprehensibility
and avoiding confusion, to give a data set set the same name as a
function
(either built in, or one of your own).
fortune("dog")
is relevant.
cheers,
Rolf Turner