RE: [R] Stuck in trying to convert repetitive code into a function

2004-03-03 Thread Simon Fear
I can't debug this because you haven't said what levels2weeklyret() does. However, I can offer a tip: use traceback() straight after the error to see exactly where it goes wrong. If still baffled, use debug() [takes a bit of learning]. To return multiple values, return a list (see ?return) or

RE: [R] Stuck in trying to convert repetitive code into a function

2004-03-03 Thread Gabor Grothendieck
Issue the command: debug(eat.a.file) and then run your eat.a.file call. This will step you through the function showing where it goes wrong. By the way, - you don't need semicolons at the end of each line, - the format you are specifying on chron is the default anyways so you can leave

[R] Stuck in trying to convert repetitive code into a function

2004-03-02 Thread Ajay Shah
Folks, I have the following repetitive code which works correctly: A = read.table(file=junior.csv, sep=,, col.names=c(date, l)); A$date = chron(as.character(A$date), format=m/d/y); r.junior = levels2weeklyret(lastfriday, A$date, A$l); plot(A$date, A$l, type=l, col=red, main=Junior