[R] How to see inside of this function?
Erik Iverson
eriki at ccbr.umn.edu
Wed Jul 14 23:00:58 CEST 2010
Bogaso Christofer wrote:
> Hi, there is a function Skewness() under fBasics package. If I type
> "skewness", I get followings:
>
Case matters in R, so please be precise.
>
>
>> skewness
>
> function (x, ...)
>
> {
>
> UseMethod("skewness")
>
> }
>
> <environment: namespace:timeDate>
>
>
>
> Would be great if someone tell me how to see the codes of this function.
That *is* the code of the function.
There are then further methods used for specific classes, which is
probably what you want to see.
For instance, look at the code of summary vs. summary.lm .
Try methods(skewness) to see which ones have been defined.
>
>
>
> 2ndly suppose I create following function:
>
>
>
> fn1 <- function(x) return(x+2)
>
>
>
> How I can make above kind of shape like, when user types "fn1" then he will
> see:
>
>
>
> fn1
>
> function(x,.)
>
> {
>
> UseMethod("fn1")
>
> }
I don't know what this means. You just have to define you function that
way. Use an actual text editor to write your functions, then send them
to R.
More information about the R-help
mailing list