Data Package Query
John Kane
Kingston ON Canada
-----Original Message-----
From: y_refai at hotmail.com
Sent: Fri, 5 Jul 2013 13:35:32 +0000
To: jrkrideau at inbox.com, rolf.turner at xtra.co.nz, jdnewmil at dcn.davis.ca.us
Subject: RE: [R] Data Package Query
Hello,
When I run the below syntax:
Trial<-read.table("Trial.txt",header=TRUE)
Trial
save.image(file="Trial.RData")
load("Trial.RData")
fit<-logistf(data=Trial, y~x1+x2)
summary(fit)
AIC(fit)
I am getting the below error:
AIC(fit)
Error in UseMethod("logLik") :
? no applicable method for 'logLik' applied to an object of class "logistf"
Can you please help with that?
Regards,
Yasmine
Date: Sat, 29 Jun 2013 05:05:28 -0800 From: jrkrideau at inbox.com Subject: Re: [R] Data Package Query To: y_refai at hotmail.com; rolf.turner at xtra.co.nz; jdnewmil at dcn.davis.ca.us CC: r-help at r-project.org I don't know what you think data(Trial) is doing but what it in fact is doing is trying to load a stored data set called Trial and it does not exist. Have a look at ?data to see what I mean. In your program data(Trial) is redundant, well actually closer to meaningless. Trial is already loaded since you created it in the read statement John Kane Kingston ON Canada
Well, currently not. We have no idea of what your data looks like and you have not told us what packages you are loading , especially where the function logistf() is coming from. We need a better constructed question to be able to help. Please read https://github.com/hadley/devtools/wiki/Reproducibility and http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example In particular I suspect that we need to see some sample data. Use dput() to supply some. That is issue the command dput(Trial) and copy the results into your email. Also list any require() or library() calls.
-----Original Message-----
From: y_refai at hotmail.com
Sent: Fri, 28 Jun 2013 12:31:11 +0000
To: rolf.turner at xtra.co.nz, jdnewmil at dcn.davis.ca.us
Subject: Re: [R] Data Package Query
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
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop! Check it out at http://www.inbox.com/marineaquarium
____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!