[R] frequency() source code

Francisco J. Zagmutt gerifalte28 at hotmail.com
Tue Nov 8 01:30:19 CET 2005




>From: Duncan Murdoch <murdoch at stats.uwo.ca>
>To: bob mccall <rcmcll at yahoo.com>
>CC: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch>
>Subject: Re: [R] frequency() source code
>Date: Mon, 07 Nov 2005 18:30:25 -0500
>
>On 11/7/2005 6:11 PM, bob mccall wrote:
> >   Greetings:
> >
> >     I am looking for the source code for the frequency function. I
> >     grepped  the following dirs  but no luck.
> >
> >     R-2.2.0/src/appl/*
> >     R-2.2.0/src/main/*
> >     R-2.2.0/src/nmath/*
> >     R-2.2.0/src/library/stats/*
> >
> >     Does anybody know the file name??
>
>Here's how I would look for it:
>
>In R, type frequency, and I get:
>
>  > frequency
>function (x, ...)
>UseMethod("frequency")
><environment: namespace:stats>
>
>So frequency is a generic function.  That's all the source there is.
>
>Now I'm probably interested in a particular method.  Let's say the
>default one.  So I try
>
>  > frequency.default
>Error: object "frequency.default" not found
>
>Oops, looks like it's hidden in a namespace.  Try again:
>
>  > getAnywhere("frequency.default")
>A single object matching 'frequency.default' was found
>It was found in the following places
>    registered S3 method for frequency from namespace stats
>    namespace:stats
>with value
>
>function (x, ...)
>if (!is.null(xtsp <- attr(x, "tsp"))) xtsp[3] else 1
><environment: namespace:stats>
>
>Now that's probably enough information, but if I really wanted to see
>the source (as opposed to the above deparsed version, which won't have
>any comments in it), then I'd know to look in src/library/stats/R, since
>it's in namespace:stats, and it's R code.  I'd grep or do another search
>of the files there and find it in src/library/stats/R/ts.R (and it turns
>out there aren't any comments after all, but it might be useful to look
>at the other functions in that file anyway).
>
>Now if someone were running from a binary install in Windows, they
>wouldn't have a full copy of the source directories; they need to
>download that separately from the binary builds.

...or, they can look at the source code directly at 
https://svn.r-project.org/R/trunk/src/library/stats/R/ts.R

Cheers

Francisco

>
>Duncan Murdoch
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! 
>http://www.R-project.org/posting-guide.html




More information about the R-help mailing list