Basic question about: <<- and method start with dot.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Basic question about: <<- and method start with dot.

Fabrice Tourre
Dear list,

When I read some source code, I find lot of place used  symbol <<- , e.g.

lastTime <<- newTime;

What is the meaning here?

Also, I find some method with the name start with dot, e.g.

.RowStandardizeCentered = function(x) {
        div = sqrt( rowSums(x^2) );
        div[ div == 0 ] = 1;
        return( x/div );
}

What is the special meaning for the method name start with a dot?

Thank you very much in advance.

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Basic question about: <<- and method start with dot.

Rolf Turner-3

On 02/10/12 17:00, Fabrice Tourre wrote:
> Dear list,
>
> When I read some source code, I find lot of place used  symbol <<- , e.g.
>
> lastTime <<- newTime;
>
> What is the meaning here?
?"<<-"

See also:

     require("fortunes")
     fortune("<<-")

>
> Also, I find some method with the name start with dot, e.g.
>
> .RowStandardizeCentered = function(x) {
> div = sqrt( rowSums(x^2) );
> div[ div == 0 ] = 1;
> return( x/div );
> }
>
> What is the special meaning for the method name start with a dot?
?ls
Note the argument "all.names".

     cheers,

         Rolf Turner

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Basic question about: <<- and method start with dot.

Peter Dalgaard-2
In reply to this post by Fabrice Tourre

On Oct 2, 2012, at 06:00 , Fabrice Tourre wrote:

> Dear list,
>
> When I read some source code, I find lot of place used  symbol <<- , e.g.
>
> lastTime <<- newTime;
>
> What is the meaning here?

Did you check help("<<-") ? The explanation there seems at least as clear as anything I could cook up in a quick mail...

>
> Also, I find some method with the name start with dot, e.g.
>
> .RowStandardizeCentered = function(x) {
> div = sqrt( rowSums(x^2) );
> div[ div == 0 ] = 1;
> return( x/div );
> }
>
> What is the special meaning for the method name start with a dot?

It means nothing in particular, except that such objects don't show up in ls() by default. The _intention_ is usually that the function is only to be used internally and not for end-user use.


--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Basic question about: <<- and method start with dot.

hadley wickham
>> What is the special meaning for the method name start with a dot?
>
> It means nothing in particular, except that such objects don't show up in ls() by default. The _intention_ is usually that the function is only to be used internally and not for end-user use.

But these days, if you're writing a package, you're better off using namespaces.

Hadley

--
RStudio / Rice University
http://had.co.nz/

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Basic question about: <<- and method start with dot.

Peter Dalgaard-2

On Oct 2, 2012, at 13:35 , Hadley Wickham wrote:

>>> What is the special meaning for the method name start with a dot?
>>
>> It means nothing in particular, except that such objects don't show up in ls() by default. The _intention_ is usually that the function is only to be used internally and not for end-user use.
>
> But these days, if you're writing a package, you're better off using namespaces.

Sure, but that doesn't keep package writers from using that kind of naming convention for non-exported objects. (Notice that this started as a question about reading 3rd party source codes.)

--
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Basic question about: <<- and method start with dot.

Fabrice Tourre
require("fortunes")
Loading required package: fortunes
>fortune("<<-")

I wish <<- had never been invented, as it makes an esoteric and dangerous
feature of the language *seem* normal and reasonable. If you want to dumb down
R/S into a macro language, this is the operator for you.
   -- Bill Venables
      R-help (July 2001)

On Tue, Oct 2, 2012 at 11:14 AM, peter dalgaard <[hidden email]> wrote:

>
> On Oct 2, 2012, at 13:35 , Hadley Wickham wrote:
>
>>>> What is the special meaning for the method name start with a dot?
>>>
>>> It means nothing in particular, except that such objects don't show up in ls() by default. The _intention_ is usually that the function is only to be used internally and not for end-user use.
>>
>> But these days, if you're writing a package, you're better off using namespaces.
>
> Sure, but that doesn't keep package writers from using that kind of naming convention for non-exported objects. (Notice that this started as a question about reading 3rd party source codes.)
>
> --
> Peter Dalgaard, Professor
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: [hidden email]  Priv: [hidden email]
>

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