Displaying 20 results from an estimated 8000 matches similar to: "The code behind the function"
2009 Sep 08
2
strange results in summary and IQR functions
Dear R users,
Something is strange in summary and IQR. Suppose, I have a data set and I
would like to find the Q1, Q2, Q3 and IQR.
x<-c(2,4,11,12,13,15,31,31,37,47)
> summary(x)
Min. 1st Qu. Median Mean 3rd Qu. Max.
2.00 11.25 14.00 20.30 31.00 47.00
> IQR(x)
[1] 19.75
However, I test the same data set in SAS "proc univariate", and SAS shows
that
2008 Jan 25
3
function code
R-help,
Sorry for this question (I guess it has been addressed before but
I could not find it in the archives)
but how can I see a function code
when the following comes up:
> svymean
function (x, design, na.rm = FALSE, ...)
{
.svycheck(design)
UseMethod("svymean", design)
}
<environment: namespace:survey>
Thanks in advance
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,
2010 Mar 31
2
Printing the function t.test() in R
Dear R Users,
I have a question, how does one print an r function like t.test in R (to get
the whole function and not just a summary of the environment)? For example
if I type the following:
> t.test
function (x, ...)
UseMethod("t.test")
<environment: namespace:stats>
> print(t.test)
function (x, ...)
UseMethod("t.test")
<environment: namespace:stats>
I
2008 Sep 09
1
probably easy methods question
Dear R Gurus:
I want to look at the code for the t.test function. I did the following:
> t.test
function (x, ...)
UseMethod("t.test")
<environment: namespace:stats>
> getAnywhere("t.test")
A single object matching 't.test' was found
It was found in the following places
package:stats
registered S3 method for t from namespace stats
namespace:stats
with
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.
2009 Sep 15
2
Viewing Function Code
Hi All,
I'd like to see the function code behind the barplots2() function in the
gplots package, however i come across a bit of a stumbling block of a hidden
function, can anyone help?
> library(gplots)
> methods(barplot2)
[1] barplot2.default*
Non-visible functions are asterisked
> barplot2
function (height, ...)
UseMethod("barplot2")
<environment:
2004 May 04
2
Seeing the definition of a function
Dear all,
I was trying to see how the function 'confint' is defined. Doing
> confint
function (object, parm, level = 0.95, ...)
UseMethod("confint")
<environment: namespace:stats>
does not really enlighten me. How can I get to see the implementation (I guess it should be possible according to the general philosophy of the R project)?
Thanks in advance
S??ren
2008 Jul 30
2
Repeated Measure ANOVA-Old question
Hi R users,
I google the website and I found that there are three ways to perform
repeated measure ANOVA: aov, lme and lmer.
http://www.mail-archive.com/r-help at stat.math.ethz.ch/msg58502.html
But the questions are which one is good to use and how to do post-hoc test?
I use the example that is provided in the above link and I try
> tt<-aov(p.pa~group*time+Error(subject/time),data=P.PA)
2006 Nov 20
1
how to forecast the GARCH volatility?
Dear All,
I have loaded package(tseries), but when I run
predict.garch(...) R tells me could not find function
"predict.garch", however ?predict.garch shows me
something. I am confused about this. How can I
forecast garch volatility?
I have tried:
predict(...,n.ahead=...),give me fitted value
predict(...,n),give me NA,NA
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
2008 Oct 27
1
How to see source code for na.omit?
Hi R helpers,
I'd like to see source code for some of built-in R functions... for
example, I would like too see how "na.omit" was implemented?
Thanks?
2007 Jul 16
3
looking at a function's code
Good morning,
I'd like to look at the code for the R function head. When I type just the word head, I get back
function(x, ...)
UseMethod("head")
<environment: namespace:utils>
I expected to see several lines of R code. Any suggestions?
Thanks,
Walt Paczkowski
2009 Apr 18
2
source code for prompt()
Dear R community,
pardon my ignorance but how would you get the source code for"non-visible
functions" ?
For example, I would like to see and modify the source code for the prompt()
function.
Thanks!
Markus
[[alternative HTML version deleted]]
2013 Jan 13
2
getting TukeyHSD code
Hello R People:
Here's the Saturday night goofy question. I would like to see the
code for TukeyHSD function and I tried the following:
> getAnywhere("TukeyHSD")
A single object matching ?TukeyHSD? was found
It was found in the following places
package:stats
namespace:stats
with value
function (x, which, ordered = FALSE, conf.level = 0.95, ...)
2010 May 28
2
How to get the definition of a function if it is masked by a variable?
Hello,
Normally, if I type a function name, it shows the function definition.
When the function is masked by a variable with the same name, it
doesn't show the function definition any more. Can anyone please tell
me a way how to retrieve the function definition even if it is masked
by a variable?
> x=1:3
> length(x)
[1] 3
> length
function (x) .Primitive("length")
>
2007 Oct 02
1
How to view the code of a method?
Dear All
I am a biginner of R.
I have difficulty with reading the code of a method.
I am using the vars package to estimate a VAR model and I want to view the code of "predict" method for objects with class attribute "varest".
I thougt I could just type the name "predict" without anything to display the code of the method as I often do with generic function.
2008 Nov 28
2
AIC function and Step function
I would like to figure out the equations for calculating "AIC" in both
"step() function" and "AIC () function". They are different. Then I
just type "step" in the R console, and found the "AIC" used in "step()
function" is "extractAIC". I went to the R help, and found:
"The criterion used is
AIC = - 2*log L + k *
2008 Mar 08
5
Non-visible functions are asterisked
Dear R-Helpers,
I suspect I'm about to ask a FAQ, but I haven't been able to find an
answer in the FAQ, AItR or an R Site Search. When I look at the methods
of summary (below) it says, "Non-visible functions are asterisked". I
looked at the help file for summary.princomp, which did not comment on
it being non-visible. I ran its help file example, which printed visible
output. I