Displaying 20 results from an estimated 20000 matches similar to: "Extracting a function from a R package"
2005 Jan 26
2
Source code for "extractAIC"?
Dear R users:
I am looking for the source code for the R function extractAIC. Type the
function name doesn't help:
> extractAIC
function (fit, scale, k = 2, ...)
UseMethod("extractAIC")
<environment: namespace:stats>
And when I search it in the R source code, the best I can find is in (R
source root)/library/stats/R/add.R:
extractAIC <- function(fit, scale, k = 2,
2011 Oct 25
1
difficulties with MuMIn model generation with coxph
Hi All,
I'm having trouble with the automatized model generation (dredge) function
in the MuMIn package. I'm trying to use it to automatically generate subsets
of models from a global cox proportional hazards model, and rank them based
on AICc. These seems like it's possible, and the Mumin documentation says
that coxph is supported. However, when I run the code (see below), it gives
2019 Oct 09
2
S3 lookup rules changed in R 3.6.1
tl;dr: S3 lookup no longer works in custom non-namespace environments as of
R 3.6.1. Is this a bug?
I am implementing S3 dispatch for generic methods in environments that are
not
packages. I am trying to emulate the R package namespace mechanism by
having a
?namespace? environment that defines generics and methods, but only exposes
the
generics themselves, not the methods.
To make S3 lookup work
2005 Jan 17
5
find source code
I am using R 2.0.2 on a WinXP
I am trying to get the code of the Kruskal-Wallis test but
> kruskal.test
function (x, ...)
UseMethod("kruskal.test")
<environment: namespace:stats>
> ls(3)
[1] "acf" "acf2AR" "add.scope"
..............
[181] "kruskal.test" "ks.test"
2008 Apr 29
2
Help on extract paramters from fitted models
Hi, I have a question about how to extract paramters from a fitted model. I
can extract coefficients and std, but from some other statistics, I dont
know how to extract. Can anyone help?
Here it is an example:
> coxout<-coxph(Surv(t,t.censor)~x)
> coxout
Call:
coxph(formula = Surv(t, t.censor) ~ x)
coef exp(coef) se(coef) z p
x 0.349 1.42 0.257 1.36 0.17
Likelihood
2006 Mar 16
2
Surv object in data.frame and Design package
Dear All,
there seems to be some strange influence of the Design package on
data.frame. If I build a data.frame containing a Surv object without
loading the package Design, the data frame is usable to coxph. If instead I
just load Design and build a data.frame afterwards, the naming of the Surv
object is different and it does not work with coxph.
(In my real application I loaded Design to use the
2010 May 19
2
How to look up source code for cor.test()
Dear all,
how can I check the source code for a hidden function like cor.test()?
At the moment I get ...
> cor.test
function (x, ...)
UseMethod("cor.test")
<environment: namespace:stats>
Thanks in advance,
Will
2007 Apr 17
3
Extracting approximate Wald test (Chisq) from coxph(..frailty)
Dear List,
How do I extract the approximate Wald test for the
frailty (in the following example 17.89 value)?
What about the P-values, other Chisq, DF, se(coef) and
se2? How can they be extracted?
######################################################>
kfitm1
Call:
coxph(formula = Surv(time, status) ~ age + sex +
disease + frailty(id,
dist = "gauss"), data = kidney)
2008 Jul 18
2
source code functions
>na.contiguous
function (object, ...)
UseMethod("na.contiguous")
<environment: namespace:stats>
this is what I get when I look for the source code for some functions- Is
there a way to look at the source code?
--
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like
2005 Jan 03
4
Inspecting R functions
In S-Plus, I can look at the structure of a function (for example, hist)
simply by entering
hist <RETURN>
however, if I do this in R, I get the response
function (x, ...)
UseMethod("hist")
<environment: namespace:graphics>
How can I inspect the structure of a function in R?
-------------------------------
Richard Dybowski
143 Village Way
2009 Apr 25
1
Overlapping parameters "k" in different functions in "ipred"
Dear List,
I have a question regarding "ipred" package. Under 10-fold cv, for different knn ( = 1,3,...25), I am getting same misclassification errors:
#############################################
library(ipred)
data(iris)
cv.k = 10 ## 10-fold cross-validation
bwpredict.knn <- function(object, newdata) predict.ipredknn(object, newdata, type="class")
for (i in
2004 Sep 27
2
Getting code for functions
Hello
Pardon for the elementary question, I did try searching the archives
with various terms, but to no avail. I am using R1.9.1 on a windows
machine
One of the great advantages of R (to me, anyway) is being able to see
the code for a function , e.g. by typing sd one sees the code for
getting a standard deviation.
However, for many functions this only provides info. including
UseMethod, eg.
2019 May 19
2
[R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.
On Sat, 18 May 2019 at 23:34, Pavel Krivitsky <pavel at uow.edu.au> wrote:
>
> > The issue here is that you are registering a non-standard name
> > (.gen.formula) for that generic and then defining what would be the
> > standard name (gen.formula) for... what purpose? IMHO, this is a bad
> > practice and should be avoided.
>
> The situation initially arose
2010 Jan 18
2
Problem extracting from mer objects
I am having a problem extracting from "mer" objects.
I have constructed my problem using existing datasets.
Using the following commands:
require(lme4)
fm1 <- lmer(Yield ~ 1 + (1 | Batch), Dyestuff)
fixef(fm1)
I get the following error message:
"Error in UseMethod("fixef") : no applicable method for "fixef""
I know that "fixef" is in
2004 Dec 16
2
reading svm function in e1071
Hi,
If I try to read the codes of functions in e1071 package, it gives me following error message.
>library(e1071)
> svm
function (x, ...)
UseMethod("svm")
<environment: namespace:e1071>
> predict.svm
Error: Object "predict.svm" not found
>
Can someone help me on this how to read the codes of the functions in the e1071 package?
Thanks.
Raj
2011 Sep 12
1
coxreg vs coxph: time-dependent treatment
Dear List,
After including cluster() option the coxreg (from eha package)
produces results slightly different than that of coxph (from survival)
in the following time-dependent treatment effect calculation (example
is used just to make the point). Will appreciate any explaination /
comment.
cheers,
Ehsan
############################
require(survival)
require(eha)
data(heart)
# create weights
2008 Apr 18
1
Overall p-value from a factor in a coxph fit
Hi all.
If I run the simple regression when x is a categorical variable ( x <-
factor(x) ):
> MyFit <-coxph( Surv(start, stop, event) ~ x )
How can I get the overall p-value on x other than for each dummy
variable?
> anova(MyFit)
does NOT provide that information as previously suggested on the list.
All the best,
Kare
[[alternative HTML version deleted]]
2011 Nov 30
1
Nomogram with stratified cph in rms package, how to get failure probability
Hello,
I am using Dr. Harrell's rms package to make a nomogram. I was able to make
a beautiful one. However, I want to change 5-year survival probability to
5-year failure probability.
I couldn?t get hazard rate from Hazard(f1) because I used cph for the model.
Here is my code:
library(rms)
f1 <- cph(Surv(retime,dfs) ~
age+her2+t_stage+n_stage+er+grade+cytcyt+Cyt_PCDK2 , data=data11,
2009 May 26
2
Using package "exams" and xtable
Hello,
I am trying to use the package "exams" to construct problem sets.
I have constructed an exercise which generates a list of integers and asks
the student to compute the median.
rx is the vector of n numbers
>str(rx)
num [1:16] 21 9 8 18 4 12 17 2 9 7 ...
I want to print out the entire vector as part of the problem.
When I use \Sexpr(rx) only the first value (in this case
2011 Jun 25
2
cluster() or frailty() in coxph
Dear List,
Can anyone please explain the difference between cluster() and
frailty() in a coxph? I am a bit puzzled about it. Would appreciate
any useful reference or direction.
cheers,
Ehsan
> marginal.model <- coxph(Surv(time, status) ~ rx + cluster(litter), rats)
> frailty.model <- coxph(Surv(time, status) ~ rx + frailty(litter), rats)
> marginal.model
Call:
coxph(formula =