Johann Petrak
2001-Oct-02 15:08 UTC
[R] Accessing just the value of an object but not the attributes
I have the feeling that this is a dumb question but oh well ... When I have an object x with several attributes, y <- x will make a copy of x with all the attributes included. What if I just want y to get the value assigned but nothing else (no class, names, dim or other attributes)? Johann -- Phone/FAX/Adr/PGPkey ... at http://www.ai.univie.ac.at/~johann -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Martin Maechler
2001-Oct-02 15:21 UTC
[R] Accessing just the value of an object but not the attributes
>>>>> "Johann" == Johann Petrak <johann at ai.univie.ac.at> writes:Johann> I have the feeling that this is a dumb question but oh well ... no, actually not at all dumb Johann> When I have an object x with several attributes, y <- x will Johann> make a copy of x with all the attributes included. What if I Johann> just want y to get the value assigned but nothing else (no Johann> class, names, dim or other attributes)? The answer -- `unfortunately' IMHO --- is as.vector() :>> Description: >> >> `vector' ....... >> >> `as.vector', a generic, attempts to coerce its argument into a >> vector of mode `mode' (the default is to coerce to whichever mode >> is most convenient). The attributes of `x' are removed.^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "unfortunately" : IMO, a vector with attributes is still a vector, particularly if these are just names.. hence as.vector() should leave it alone, but -- alas -- it's for compatibility reasons too important to be changed. So even if a new dropattributes() function would do what as.vector() does now, it would break too much code if as.vector() was changed... Note that "unfortunately" is my personal opinion, not a general R core one. Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <>< -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I've just upgraded to 1.3.1. The new installer SetupR.exe is wonderful! Thanks, Brian! Also install.packages() works well. A few questions, though. 1. There seems to be no help on tseries. 2. The old packages from my earlier installation of R appear along with the new packages in the html packages help file. I find that I can load these packages still, with a lot of searching noise coming from the disk drive. Now this may be an advantage, but I will surely want to junk some of these old packages soon. I wonder if things will get messy at this point? 3. Some familiar old packages are gone. I wonder where their functionality is now? I'm thinking of (for me) ctest, eda, lqs, modreg, mva, splines, stepfun, tcltk. (I won't ask this about ts - maybe I can use ts help for tseries functions?) Murray Jorgensen Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: maj at waikato.ac.nz Fax +64-7 838 4155 Phone +64-7 838 4773 home phone +64-7 856 6705 Mobile +64-21 139 5862 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I see my error now. Those packages I mention are in "base". At 09:50 PM 3-10-01 +1200, Murray Jorgensen wrote:>I've just upgraded to 1.3.1. The new installer SetupR.exe is wonderful! >Thanks, >Brian! Also install.packages() works well. > >A few questions, though. > >1. There seems to be no help on tseries. > >2. The old packages from my earlier installation of R appear along with the >new >packages in the html packages help file. I find that I can load thesepackages>still, with a lot of searching noise coming from the disk drive. Now this may >be an advantage, but I will surely want to junk some of these old packages >soon. I wonder if things will get messy at this point? > >3. Some familiar old packages are gone. I wonder where their functionality is >now? I'm thinking of (for me) ctest, eda, lqs, modreg, mva, splines, stepfun, >tcltk. (I won't ask this about ts - maybe I can use ts help for tseries >functions?) > >Murray Jorgensen > > > > >Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html >Department of Statistics, University of Waikato, Hamilton, New Zealand >Email: maj at waikato.ac.nz Fax +64-7 838 4155 >Phone +64-7 838 4773 home phone +64-7 856 6705 Mobile +64-21 139 5862 > >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.->r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html >Send "info", "help", or "[un]subscribe" >(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._>Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: maj at waikato.ac.nz Fax +64-7 838 4155 Phone +64-7 838 4773 home phone +64-7 856 6705 Mobile +64-21 139 5862 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._