Actually, you can do this using locked bindings. Look at ?lockBinding Locked bindings are how namespaces get const function definitions, and active bindings (on the same help page) are how R CMD check notices that you are using T and F when you mean TRUE and FALSE.
-thomas On Wed, Mar 16, 2011 at 1:52 PM, <rex.dw...@syngenta.com> wrote: > Cheer up! R is a step closer to that concept than the old FORTRAN compilers > that couldn't even guarantee that 37 was a constant if used repeatedly in a > subroutine call. > > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Uwe Ligges > Sent: Tuesday, March 15, 2011 2:23 PM > To: xiagao1982 > Cc: r-help > Subject: Re: [R] Does R have a "const object"? > > > > On 15.03.2011 15:53, xiagao1982 wrote: >> Hi, all, >> >> Does R have a "const object" concept like which is in C++ language? I want >> to set some data frames as constant to avoid being modified unintentionally. >> Thanks! > > > Although there is almost never a "No" in R, the best short answer is: "No". > > Best, > Uwe Ligges > > >> >> >> >> xiagao1982 >> 2011-03-15 >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org 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. > > ______________________________________________ > R-help@r-project.org 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. > > > > > message may contain confidential information. If you are not the designated > recipient, please notify the sender immediately, and delete the original and > any copies. Any use of the message by you is prohibited. > ______________________________________________ > R-help@r-project.org 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. > -- Thomas Lumley Professor of Biostatistics University of Auckland ______________________________________________ R-help@r-project.org 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.