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

2011-05-12 Thread MatAra
Thanks a lot for your reply Jim. I want to be able to run flex(xx-xx-,xx-xx-) at multiple date ranges, but couldn't make it work because I wasn't using the correct syntax. I will give it a try and post my findings (not too spectacular, of course). Thanks again, Mateo -- View this mes

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

2011-05-11 Thread jim holtman
Depends on what you want to do with the date. If it is a character string, then just quote it: flex("xx-xx-","xx-xx-") If you want it as a Date or POSIXct object, then convert it: flex(as.Date('2011-05-01"), as.Date('2011;05-31")) It all depends on how you are using it in your custom

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

2011-05-11 Thread MatAra
Hello gentlemen, This is a great discussion. Thank you all for providing useful answers. I am also new to R, was working mostly with SAS before, and have a question regarding passing arguments to R functions that are wrapped in quotes. Using the previous example: getSymbols(tickers, from="start

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

2011-04-06 Thread David Winsemius
On Apr 6, 2011, at 12:06 PM, algotr8der wrote: 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 a

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 f

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" ..

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

2011-03-13 Thread Joshua Ulrich
Sorry for the late reply. Here's another approach using quantmod::getSymbols. It implicitly loops over a vector of tickers. require(quantmod) getSymbols(tickers[,1], from="2011-01-01", to="2011-01-31") # If you want to merge all the close prices into one object: ClosePrices <- do.call(merge, lap

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

2011-03-13 Thread David Winsemius
On Mar 13, 2011, at 2:29 PM, algotr8der wrote: 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'

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 tha

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

2011-03-12 Thread David Winsemius
On Mar 13, 2011, at 1:28 AM, Dennis Murphy wrote: Hi: (1) The first argument to get.hist.quote() is instrument, not instruments. I concur with David that get.hist.quote() takes a single character string as an argument. (2) I tried running this with lapply() but got a download error on

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

2011-03-12 Thread Dennis Murphy
Hi: (1) The first argument to get.hist.quote() is instrument, not instruments. I concur with David that get.hist.quote() takes a single character string as an argument. (2) I tried running this with lapply() but got a download error on the last one: getStockData("PBR-B") trying URL ' http:

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

2011-03-12 Thread David Winsemius
On Mar 13, 2011, at 12:18 AM, algotr8der wrote: 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

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] "

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

2011-03-12 Thread David Winsemius
On Mar 12, 2011, at 3:08 PM, algotr8der wrote: 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

[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=",") ticke