On Tue, Dec 11, 2012 at 2:27 PM, Duncan Murdoch <murdoch.duncan@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]]


