On 9/22/2006 4:02 PM, Sender wrote:
> Hello R-help:
> 
> I was hoping someone could help me understand a particular function i came
> across in a package:
> 
> "$.myClass" <- function( x, name ) {
>         sym = paste( "foo", name, sep = "_" )
>          if( is.loaded(sym) )
>              .Call(sym,x)
> }
> 
> I understand the paste, and .Call part, but I'm not sure how this function
> would get called? What exactly is $. ? is it a regular expression? Would a
> user call this method directly, or is it an internal function that gets
> called according to a class/type.

It's the implementation of the "$" function for myClass objects, so if x 
was a myClass object, it would be called when something like

x$name

was used in an expression.  It would call an external function named 
foo_name, passing x as an argument.

Duncan Murdoch

> 
> something similar to:
> 
> plot.lm()
> 
> Thanks in advance !
> 
> Greg
> 
>       [[alternative HTML version deleted]]
> 
> ______________________________________________
> [email protected] 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.

______________________________________________
[email protected] 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.

Reply via email to