What about putting your objects in a list, which does not have the search through parents semantics? --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity.
Worik R <wor...@gmail.com> wrote: >> >> You may find it more reliable to define an environment in which you >> will be storing your data (perhaps globalenv(), perhaps something >created >> by new.env()) and then testing for existence of a dataset by a given >name >> in that environment. >> >> >I did that. > >PAIR.ENV <- new.env() >.... >get("USDCHF", env=PAIR.ENV) > >returns trhe USDCHF defined in timeSeries > >This is very hard! > >Worik > >Bill Dunlap >> Spotfire, TIBCO Software >> wdunlap tibco.com >> >> >> > -----Original Message----- >> > From: r-help-boun...@r-project.org >[mailto:r-help-boun...@r-project.org] >> On Behalf >> > Of Worik R >> > Sent: Monday, December 10, 2012 5:47 PM >> > To: Duncan Murdoch >> > Cc: r-help >> > Subject: Re: [R] Removing named objects using rm(..) >> > >> > On Tue, Dec 11, 2012 at 2:27 PM, Duncan Murdoch >> > <murdoch.dun...@gmail.com>wrote: >> > >> > > On 12-12-10 7:33 PM, Worik R wrote: >> > > >> > >> Let me restate my question. >> > >> >> > >> Is there a straightforward way of ensuring I can use the >variable name >> > >> USDCHF? >> > >> >> > > >> > > You can use any legal variable name. The only risk is that you >will >> > > overwrite some other variable that you created. You can't >overwrite >> > > variables from packages. (You might mask them, but they are >still >> > > accessible using the :: notation. E.g. after you set >> > > >> > > USDCHF <- NULL >> > > >> > >> > Exactly. I got around this by assigning NULL to the variable names >that >> I >> > would have deleted. Then instead of testing for existence I tested >for >> > NULL. >> > >> > >> > > >> > > you can still access the one in timeSeries using >> > > >> > > timeSeries::USDCHF >> > >> > >> > Christ. That is what I wanted to delete. I read the scoping >section of >> > R-Lang (again) and nothing I could see prepared me for the shock >of... >> > >> > > library(timeSeries) >> > > nrow(USDCHF) >> > [1] 62496 >> > > rm(USDCHF) >> > Warning message: >> > In rm(USDCHF) : object 'USDCHF' not found >> > > nrow(USDCHF) >> > [1] 62496 >> > >> > >> > The message from rm was that USDCHF did not exist. But I can still >> access >> > its properties with nrow. >> > >> > This is very broken. I would not have believed I would see that in >the >> > 21st century with a modern language. (Oh wait, there is Javascript >and >> > PHP, so in comparison R is not that broken) >> > >> > I am not new to R, I have been (mis)using it for 5 years. I love >aspects >> > of R, but this and a few other things (lack of debugging support >and >> > ignoring the "principle of least surprise" are two biggies) are >very >> > frustrating. Without debugging support or more help from the >compiler >> > (like a "cannot rm EURCHF" message instead of a lie) R causes as >many >> > problems as it solves. >> > >> > Sigh. Thanks for the help. >> > >> > Worik >> > >> > >> > >> > >> > > >> > >> > [[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. >> > > [[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.