[R] Problem with data.frames
kjetil brinchmann halvorsen
kjetil at entelnet.bo
Mon Aug 4 21:20:01 CEST 2003
On 4 Aug 2003 at 11:09, Simon Fear wrote:
> Peter is right, but there is a point here: it would be nice if
> attach(my.dframe) would do nothing - or at least warn - if my.dframe was
> already in the search list. Like library(). Attaching twice is almost
> bound
> to be an error?
Not necessarily. If you changed the data --- as when debugging a data
file and repeatedly sourcing it in --- you need to attach repeatedly.
Of course, you should detach() first, but that is not a requirement
today.
Kjetil Halvorsen
> Of course in many circumstances it might be better to use with() than
> attach() - if you haven't come across with(), it works like attach()
> with an
> inbuilt detach() when the parentheses close.
>
> Aside 1: it would also be nice if ?attach pointed to ?with. Is this kind
> of
> suggestion best sent to r-help or r-devel?
>
> Aside 2: is with() efficient, or does it create a copy of the dataset?
>
> SF
>
>
> -----Original Message-----
> From: Peter Dalgaard BSA [mailto:p.dalgaard at biostat.ku.dk]
> Sent: 04 August 2003 00:52
> To: Andreas Eckner
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Problem with data.frames
>
>
> Security Warning:
> If you are not sure an attachment is safe to open please contact
> Andy on x234. There are 0 attachments with this message.
> ________________________________________________________________
>
> Andreas Eckner <andreas.eckner at soundinvest.net> writes:
>
> > Hi,
> >
> > I just encountered a problem in R that may easily be fixed: If one
> uses
> > attach for a data.frame e.g. 10000 times and forgets detach, then R
> gets
> > incredibly slow (less then 10% of the original speed).
>
> R also gets incredibly slow if you create 10000 copies of your data
> set, which is effectively the same thing! The fix is: Don't do that...
>
> --
> O__ ---- Peter Dalgaard Blegdamsvej 3
> c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
> (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>
> Simon Fear
> Senior Statistician
> Syne qua non Ltd
> Tel: +44 (0) 1379 644449
> Fax: +44 (0) 1379 644445
> email: Simon.Fear at synequanon.com
> web: http://www.synequanon.com
>
> Number of attachments included with this message: 0
>
> This message (and any associated files) is confidential and\...{{dropped}}
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list