[R] as.date: do not know how to convert 'test[1]' to class Date

2012-08-01 Thread algotr8der
I have an object, which I pull in from a csv file here http://r.789695.n4.nabble.com/file/n4638691/jan_2011.csv jan_2011.csv mydata - read.csv(jan_2011.csv, header=TRUE, sep=,) head(mydata) Delivery.Date Hour.Ending Repeated.Hour.Flag Settlement.Point Settlement.Point.Price 101/01/2011

Re: [R] as.date: do not know how to convert 'mydata[1]' to class Date

2012-08-01 Thread algotr8der
Thank you Ricardogg and Arun. I don't know how I missed that. Too many sleepless nights perhaps. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/as-date-do-not-know-how-to-convert-mydata-1-to-class-Date-tp4638691p4638708.html Sent from the R help mailing list archive

Re: [R] pass character vector in instrument field of get.hist.quote function

2011-04-06 Thread algotr8der
Hi Joshua, Thank you for showing me how to use the getSymbols function. So I tried the following without success - tickers [1] SPY DIA IWM SMH OIH XLY XLP XLE XLI XLB XLK XLU XLV [14] QQQ str(tickers) chr [1:14] SPY DIA IWM SMH OIH XLY XLP XLE ... ClosePrices - do.call(merge,

Re: [R] pass character vector in instrument field of get.hist.quote function

2011-04-06 Thread algotr8der
Hi Joshua, THank you for showing me how to use getSymbols. I am trying to follow the example you provided. However I am having some difficulty using the various combination of functions you have used. I tried to execute one step at a time as follows - I have a ticker vector that looks like the

[R] R-project: plot 2 zoo objects (price series) that have some date mis-matches

2011-04-03 Thread algotr8der
I have 2 zoo objects - 1) Interest rate spread between 10-YR-US-Treasury and 2-YR-US-Treasury (object name = sprd) 2) SP 500 index (object name = spy) str(spy) ‘zoo’ series from 1976-06-01 to 2011-03-31 Data: num [1:8791] 99.8 100.2 100.1 99.2 98.6 ... Index: Class 'Date' num [1:8791]

[R] using R variables in RMySQL query

2011-03-23 Thread algotr8der
I have the following function myGetstockdataMySQL - function(startdate, enddate, ticker) { con - dbConnect(MySQL(), user=blahblah, password=blahblah, dbname=blahblah, host=localhost) rs - dbGetQuery(con, SELECT price.close FROM price INNER JOIN stocks ON stocks.stock_id=price.stock_ID WHERE

[R] read file part way through based on start and end date (first column)

2011-03-20 Thread algotr8der
Hello folks - I have been trying to figure this out. I have a set of very large files that are of this format , , , , 1/4/1999,9:31:00 AM,blah, blah, blah 1/4/1999,9:32:00 AM,blah, blah, blah 1/4/1999,9:33:00 AM,blah, blah, blah I want to write R code that reads only that data between a start

Re: [R] read file part way through based on start and end date (first column)

2011-03-20 Thread algotr8der
Thanks Jim for the reply. The file has 1,183,318 rows and there are 20 such files. Too big for R to handle? -- View this message in context: http://r.789695.n4.nabble.com/read-file-part-way-through-based-on-start-and-end-date-first-column-tp3391769p3392005.html Sent from the R help mailing

Re: [R] read file part way through based on start and end date (first column)

2011-03-20 Thread algotr8der
THanks Jim. Eventually I do want to store the records in a database... so mySQL. But right now I want to run some analytics on the data so I'm looking for a quick and dirty solution that can give me the flexibility to extract data on various time periods. I think a perl script that uses

Re: [R] pass character vector in instrument field of get.hist.quote function

2011-03-13 Thread algotr8der
Thank you all. Your solutions work. I suppose it doesnt matter whether I use coredata or not (at least for my current purposes). I have created a user-defined function and have saved it in a .R file in my current working directory. But now I'm not sure how to invoke this function. R complains that

[R] pass character vector in instrument field of get.hist.quote function

2011-03-12 Thread algotr8der
I am new to R so I apologize if my question is trivial. I have not been able to figure out whether what I want to do is even possible. I have a data frame of stock ticker symbols which I store into R space from a txt file as follows: tickers - read.csv(stocks.txt, header=FALSE, sep=,) tickers -

Re: [R] pass character vector in instrument field of get.hist.quote function

2011-03-12 Thread algotr8der
Thanks David for the reply. I just tried the following with the same result: library(tseries) tickers - read.csv(testticker.txt, header=FALSE, sep=,) tickers - tickers[1] V1 1 XOM 2 COP 3 PBR-A 4 FFIV 5SU 6 PBR-B tickers$V1 - as.character(tickers$V1) tickers$V1 [1] XOM COP