[R] Simple problem with lm/predict

2010-08-14 Thread Nick Torenvliet
Hi all, I've got an xts time series with monthly OHLC Dow Jones industrial index data from 1980 to present, the data is in stored in x. I've done an OLS fit on the data in 1982::1994 and stored it in extrapolate1 (x[,4] contains the closing value for the index). t3 - seq(1980,1994,length =

[R] Help Choosing Start Values for nls

2010-08-21 Thread Nick Torenvliet
Hi all, I'm trying to do a simple curve fit and coming up with some interesting results I would like to get comment on. So as shown below, tsR is my explanatory and response is... well... my response. This same data in gnumeric gets fitted with the curve response=10078.4 + 1358.67 * ln

[R] Closing files after using write

2009-12-21 Thread Nick Torenvliet
When I run the following code in a loop I get an error after about 125 times saying too many open files... if(inherits(atmpt, try-error)){ output - paste(yahooSymbol,\n,sep=) write(output, file = data, append = TRUE, sep = ) } else { I've tried various things to close

Re: [R] Closing files after using write

2009-12-21 Thread Nick Torenvliet
That would work... except I've got a DBConnection I don't want to close and open constantly On Mon, Dec 21, 2009 at 12:28 PM, Henrique Dallazuanna www...@gmail.comwrote: Try: closeAllConnections() On Mon, Dec 21, 2009 at 3:22 PM, Nick Torenvliet nick.torenvl...@gmail.com wrote: When I

Re: [R] Closing files after using write

2009-12-21 Thread Nick Torenvliet
; and you should be fine. You also don't need to open the file 125 times: open it before the loop. --Gray On Mon, Dec 21, 2009 at 11:22 AM, Nick Torenvliet nick.torenvl...@gmail.com wrote: When I run the following code in a loop I get an error after about 125 times saying too many open files

[R] accessing members of a data.frame

2009-12-28 Thread Nick Torenvliet
I have the following code fileList -list.files(path = ., pattern = [^a-z].txt$, all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE) for (x in 1:length(fileList)){ fileLines - data.frame(read.table(fileList[x])) print(string) } the lines of the file all have the

[R] Accessing members

2009-12-28 Thread Nick Torenvliet
Consider the following fileLines V1 V2V3V4 V5 V6V7 V8 1 AB 20091224 156.0 156.0 154.00 154.0055 1198 2 AB.C 20091224 156.0 156.0 156.00 156.00 0 0 3 ABF10 20091224 156.0 156.0 156.00 156.0055444 4 ABH10 20091224 156.0 156.0

Re: [R] Accessing members

2009-12-28 Thread Nick Torenvliet
Thanks everyone... the as.character(fileLines[1][1]) solution worked well... Factors??? the treatment is so far away from what I know. Cool though... On Mon, Dec 28, 2009 at 8:55 PM, David Winsemius dwinsem...@comcast.netwrote: On Dec 28, 2009, at 5:14 PM, Nick Torenvliet wrote

[R] error logging

2009-12-28 Thread Nick Torenvliet
Yet another question... I'm wondering if there is a built in facility to log errors. I've got this statement that gives me verbose DBI errors as they come up (to standard output), but I'd like to trap and log them to a file as I running about 300 sql statements through this particular piece

Re: [R] error logging

2009-12-28 Thread Nick Torenvliet
/a # generate an error On Mon, Dec 28, 2009 at 11:11 PM, Nick Torenvliet nick.torenvl...@gmail.com wrote: Yet another question... I'm wondering if there is a built in facility to log errors. I've got this statement that gives me verbose DBI errors as they come up (to standard output

[R] seg-fault... but on what

2009-12-30 Thread Nick Torenvliet
I got the following after running succesfully through this loop 28 million times... the loop opens text files in a directory and inserts line by line into a database... *** caught segfault *** address 0xc010, cause 'memory not mapped' Traceback: 1: .getGeneric(f, where, package) 2:

Re: [R] seg-fault... but on what

2009-12-30 Thread Nick Torenvliet
Thanks Duncan, I'll work on reproducibility and possibly getting a core dump... If I get those I'll post to R-dev or RMySQL-dev. Nick On Wed, Dec 30, 2009 at 9:36 AM, Duncan Murdoch murd...@stats.uwo.cawrote: On 30/12/2009 9:20 AM, Nick Torenvliet wrote: I got the following after running

[R] capturing stdout

2009-12-30 Thread Nick Torenvliet
I'm wondering if anyone knows of a way to capture system messages, for instance when I do the following: system(../DBScripts/getEODData.sh) .//LSE_20091230.txt: 154.80 kB 207.24 kB/s ./Fundamentals//LSE.txt: 420.58 kB 301.47 kB/s

[R] Simple 3D Plot Question

2010-06-15 Thread Nick Torenvliet
Hi all, I've got a simple 3D plot as follows... xx - seq(-20,20,.5) yy - seq(-20,20,.5) zFunc - function(x,y){3*x^2*y} z - outer(xx,yy,zFunc) persp(xx,yy,z,theta=30,phi=30,ticktype=detailed) Just beautiful! My question is how do I constrain the plot to only display x^2 = y = 1? Thanks in

[R] Labels for matplot x axis

2010-06-22 Thread Nick Torenvliet
Hi all, I've been messing with this for a while now.. myStudy is a matrix of word frequency to date of document/document. As you can see I'm trying to plot the series in the matrix. I'd like three things -- 1- In the plot that gets created the first series is a solid line, the rest are

Re: [R] Labels for matplot x axis

2010-06-22 Thread Nick Torenvliet
on the graph as a label with a tickmark... is this possible? On Tue, Jun 22, 2010 at 7:48 AM, Jim Lemon j...@bitwrit.com.au wrote: On 06/22/2010 08:05 PM, Nick Torenvliet wrote: Hi all, I've been messing with this for a while now.. myStudy is a matrix of word frequency to date of document/document

[R] Subtracting time series

2010-02-02 Thread Nick Torenvliet
Hi all, I've got a time series object (xts) called table. Table contains closing price and volume for each market day of 2009 on a given equity. I'd like to get another xts object, say table2, that contains for each market day holds the close of that day minus the close of the day before and

[R] Plotting by factor with xts

2011-01-22 Thread Nick Torenvliet
Hi all, I've got an xts time series of stock symbols and closing prices. head(x) symbol close 2010-01-04 AFB 13.46 2010-01-04 AKP 12.80 2010-01-04 APX 8.78 2010-01-04 AYN 13.15 2010-01-04 BAF 13.50 2010-01-04 BBF 12.86 tail(x) symbol close 2011-01-21 VMO 12.35

[R] Plotting multiple xts/zoo time series on a single plot.

2011-01-22 Thread Nick Torenvliet
So I've got a 154 column wide xts time series object and I want to plot the 154 series on a single plot and have the added benefit of the time series dates on the x axis. Any suggestions for plotting functions, maplot works but does not give dates on the axis and I can't seem to get plot to give

[R] Error w tokenizer .jcall unless run as root

2011-02-02 Thread Nick Torenvliet
Hi all, I've got an R script that loads the following libraries library(rJava) library(RWeka) library(tm) At some when I try to run the tm tokenizer as MyTokenizer - function(x) NGramTokenizer(x, Weka_control(min = 1, max = 4)) ECONOMIST_TDM -

[R] xyplot text sizing

2011-02-13 Thread Nick Torenvliet
Hi all, I'm using xyplot(closingDataXTS) To get a page with any number of seperate plots on it (as many plots as columns in closingDataXTS). Each plot is named according to colnames(closingDataXTS). I would like to control the size of the text each plot name appears in. I've seen a number of