From thomas@biostat.washington.edu  Mon Feb 28 02:27:19 2000
From: thomas@biostat.washington.edu (Thomas Lumley)
Date: Mon, 28 Feb 2000 02:27:19 +0000 (GMT)
Subject: [Rd] Parser Bug Somewhere.... (PR#460)
In-Reply-To: <200002280051.BAA23077@pubhealth.ku.dk>
Message-ID: <Pine.LNX.4.10.10002280217400.21249-100000@gimel.biostat.washington.edu>

On Mon, 28 Feb 2000 john-cavanaugh@cableone.net wrote:

> Full_Name: John P Cavanaugh
> Version: .99
> OS: linux
> Submission from: (NULL) (24.116.10.99)
> 
> 
> dataset$ema12 <- EMA (dataset$Close,12)
> dataset$ema26 <- EMA (dataset$Close,26)
> dataset$MACD_fast <- dataset$ema26 - dataset$ema12
> dataset$MACD_slow <- EMA(dataset$MACD_fast,9)
> 
> dataset$MACD_hist <- dataset$MACD_fast - dataset$MACD_slow  # This line doesnt
> work!!!
> 
> 
> But... if I does work if I do the following
> 
> dataset$MACDfast <- dataset$ema26 - dataset$ema12
> dataset$MACDslow <- EMA(dataset$MACDfast,9)
> dataset$MACDhist <- dataset$MACDfast - dataset$MACDslow
> 
> Something seems wrong if you have an underscore in the dataname.  I think
> this is a valid name and shouldnt need to be escaped inside of "". 

No, it's not a valid name. The underscore is a synonym for the assignment
operator <-, and so needs to be quoted if you use it. 

If you think this is horrible you're quite right, but the S language
allows _ for <- and many people are used to it.

The commonest S usage is MACD.fast, though some people use capital letters
for embedded words -- MACDFast. Both are used in the base R package:
as.vector(), getOption().


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Parser Bug Somewhere.... (PR#460)
Thomas Lumley