Fabrice Tourre
2012-Oct-02 04:00 UTC
[R] Basic question about: <<- and method start with dot.
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.
Rolf Turner
2012-Oct-02 04:31 UTC
[R] Basic question about: <<- and method start with dot.
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
peter dalgaard
2012-Oct-02 06:40 UTC
[R] Basic question about: <<- and method start with dot.
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: pd.mes at cbs.dk Priv: PDalgd at gmail.com