[R] Another quantmod question

2011-05-08 Thread Russ Abbott
I'm having troubles with the names of columns. quantmod deal with stock quotes. I've created an array of the first 5 closing prices from Jan 2007. (Is there a problem that the name is the same as the variable name? There shouldn't be.) close close 2007-01-03 1416.60 2007-01-04

Re: [R] Another quantmod question

2011-05-08 Thread Russ Abbott
I understand Josh's example: mat - matrix(1:10, dimnames = list(NULL, A)) cbind(X = 11:20, Y = mat + 1) cbind(X = 11:20, Y = mat[, A] + 1) In the line, cbind(X = 11:20, Y = mat + 1), it would be nice if an error or warning message were issued to the effect that the Y = part is ignored or not

Re: [R] Another quantmod question

2011-05-08 Thread Russ Abbott
tolerable. If this is frustrating to you you should stop using the class. Jeff Jeffrey Ryan|Founder| jeffrey.r...@lemnica.com jeffrey.r...@lemnica.com www.lemnica.com On May 8, 2011, at 2:07 PM, Russ Abbott russ.abb...@gmail.com wrote: I'm having troubles with the names

Re: [R] Another quantmod question

2011-05-08 Thread Russ Abbott
, On May 8, 2011 6:29 PM, Russ Abbott russ.abb...@gmail.com wrote: Hi Jeff, The xts class has some very nice features, and you have done a valuable service in developing it. My primary frustration is how difficult it seems to be to find out what went wrong when my code doesn't work. I've

[R] Convenience-at-the-expense-of-clarity (was: quantmod's addTA plotting functions)

2011-05-07 Thread Russ Abbott
-consuming. Peter Ehlers On 2011-05-05 10:42, Russ Abbott wrote: Thanks. You're right. I didn't see that. I read the ?addTA help page, which (annoyingly) didn't mention that feature, but I didn't read the ?TA page. (That page was mentioned as a see also, but not as a must see.) I don't know

[R] quantmod's addTA plotting functions

2011-05-05 Thread Russ Abbott
Hi, I'm having trouble with quantmod's addTA plotting functions. They seem to work fine when run from the command line. But when run inside a function, only the last one run is visible. Here's an example. test.addTA - function(from = 2010-06-01) { getSymbols(^GSPC, from = from)

Re: [R] quantmod's addTA plotting functions

2011-05-05 Thread Russ Abbott
, May 5, 2011 at 3:39 AM, P Ehlers ehl...@ucalgary.ca wrote: On 2011-05-05 0:47, Russ Abbott wrote: Hi, I'm having trouble with quantmod's addTA plotting functions. They seem to work fine when run from the command line. But when run inside a function, only the last one run is visible. Here's

[R] Still confused about classes

2011-04-29 Thread Russ Abbott
Hi, I'm still confused about how to find out what methods are defined for a given class. For example, I know that today - Sys.Date() will produce an object of type Date. But I'm not sure what I can do with Date objects or how I can find out. ?Date refers me to the Date documentation page.

Re: [R] Still confused about classes

2011-04-29 Thread Russ Abbott
two more ( as.yearmon.Date and as.yearqtr.Date). Regards, Kenn On Fri, Apr 29, 2011 at 9:05 AM, Russ Abbott russ.abb...@gmail.com wrote: Hi, I'm still confused about how to find out what methods are defined for a given class. For example, I know that today - Sys.Date

[R] Help with objects

2011-04-25 Thread Russ Abbott
variables in a quantmod object. Thanks. *-- Russ Abbott* *_* *** Professor, Computer Science* * California State University, Los Angeles* * Google voice: 747-*999-5105 * blog: *http://russabbott.blogspot.com/ vita: http://sites.google.com/site

Re: [R] R and lazy evaluation

2011-04-09 Thread Russ Abbott
, Apr 8, 2011 at 8:36 PM, Russ Abbott russ.abb...@gmail.com wrote: Here's how to do it in Haskell. First define fibs to be an infinite list. Since Haskell is lazy, the list isn't actually created until needed. The function zipWith takes three arguments: a function and two lists. (It is similar

Re: [R] R and lazy evaluation

2011-04-09 Thread Russ Abbott
be mixed with negative subscripts *-- Russ Abbott* *_* *** Professor, Computer Science* * California State University, Los Angeles* * Google voice: 747-*999-5105 * blog: *http://russabbott.blogspot.com/ vita: http://sites.google.com/site/russabbott

Re: [R] R and lazy evaluation

2011-04-09 Thread Russ Abbott
again: 1 1 1 [1] 3 5 8 *-- Russ Abbott* *_* *** Professor, Computer Science* * California State University, Los Angeles* * Google voice: 747-*999-5105 * blog: *http://russabbott.blogspot.com/ vita: http://sites.google.com/site/russabbott

Re: [R] R and lazy evaluation

2011-04-08 Thread Russ Abbott
])) Error: object 'fibs' not found But since this is a recursive definition in a context in which recursion is not expected, an error message is produced. *-- Russ * On Fri, Apr 8, 2011 at 12:51 AM, peter dalgaard pda...@gmail.com wrote: On Apr 8, 2011, at 06:08 , Russ Abbott wrote: Haskell

[R] R and lazy evaluation

2011-04-07 Thread Russ Abbott
Haskell is the prototypical lazy evaluation language. One can compute a Fibonacci sequence by the Haaskell equivalent of the following R code. fibs - c(0, 1, rep(0, 8)) fibs[3:10] - fibs + fibs[-1] This works as follows. fibs = 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 fibs = 0, 1, 0, 0, 0, 0, 0, 0, 0, 0

[R] Referring to objects themselves

2011-03-19 Thread Russ Abbott
Is it possible to refer to an object from within a method, as in *this *in Java? I can't find anything about this in the documentation. Sorry if I missed it. Thanks. *-- Russ Abbott* *_* *** Professor, Computer Science* * California State

Re: [R] Referring to objects themselves

2011-03-19 Thread Russ Abbott
this? Thanks. *-- Russ Abbott* *_* *** Professor, Computer Science* * California State University, Los Angeles* * Google voice: 747-*999-5105 * blog: *http://russabbott.blogspot.com/ vita: http://sites.google.com/site/russabbott

Re: [R] Referring to objects themselves

2011-03-19 Thread Russ Abbott
itself is stored in '.self' and can be referenced that way. HTH, Janko -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Russ Abbott Gesendet: Samstag, 19. März 2011 23:35 An: r-help@r-project.org Betreff

Re: [R] Referring to objects themselves

2011-03-19 Thread Russ Abbott
Wonderful! Thanks. I think I've got it. You can even put this - environment() at the top as long as this is returned at the end. I gather that the environment keeps accumulating elements even though it is assigned to 'this' at the beginning. I had thought that $ worked only on lists,

Re: [R] Referring to objects themselves

2011-03-19 Thread Russ Abbott
don't), rethink how you think of classes and objects in R (= think functional language). Though, you would learn lots by playing around with environments and scopes and R's method dispatching mechanisms. /Henrik On Sat, Mar 19, 2011 at 6:45 PM, Russ Abbott russ.abb...@gmail.com wrote: Thanks

[R] R as a non-functional language

2011-03-19 Thread Russ Abbott
I'm reading Torgo (2010) *Data Mining with R*http://www.liaad.up.pt/~ltorgo/DataMiningWithR/code.htmlin preparation for a class I'll be teaching next quarter. Here's an example that is very non-functional. pH - c(4.5,7,7.3,8.2,6.3) names(pH) - c('area1','area2','mud','dam','middle') pH area1

Re: [R] R as a non-functional language

2011-03-19 Thread Russ Abbott
-project.org Subject: Re: [R] R as a non-functional language On Sun, Mar 20, 2011 at 12:20 AM, Russ Abbott russ.abb...@gmail.com wrote: I'm reading Torgo (2010) *Data Mining with R*http://www.liaad.up.pt/~ltorgo/DataMiningWithR/code.htmlin preparation for a class I'll be teaching next quarter