Displaying 4 results from an estimated 4 matches for "stockdata".
2000 Jul 07
1
reorganizing a data frame
Hi,
I have what I think is an easy question.
I have a data frame, called stockdata, of stock prices that looks like this:
date ticker close
1 01/02/1998 GE 24.667
2 01/05/1998 GE 25.104
3 01/06/1998 GE 24.771
4 01/07/1998 GE 24.979
5 01/08/1998 GE 24.750
6 01/02/1998 HIT 71.125
7 01/05/1998 HI...
2011 Mar 12
3
pass character vector in instrument field of get.hist.quote function
...eader=FALSE, sep=",")
tickers <- tickers[1] / the tickers are stored in the first column
> tickers
V1
1 BCSI
2 WBSN
3 NTAP
4 FFIV
5 SU
> is.vector(tickers)
[1] FALSE
>
> is.data.frame(tickers)
[1] TRUE
I tried to do the following without success.
stockdata <- data.frame()
stockdata <- coredata(get.hist.quote(instruments=tickers,
start="2011-01-01", end="2011-01-31", quote=c("Close"), provider="yahoo"))
Error in get.hist.quote(instruments = tickers, start = "2011-01-01", end =
"2011-01-31&...
2008 Dec 14
1
how to convert factors to numbers
...closing price, volume and adjusted price (i.e.,
adjusted for dividends and splits). I want to read and manipulate the data
in R. However, when I use read.table, it treats all of the data as
"factors" and I do not know how to treat the data as numbers:
> spy<-read.table("c:\\StockData\\SPY.txt")
> attach(spy)
> names(spy)<-c("QDate","OpenP","HighP","LowP","CloseP","Vol","AdjP")
> spy[1,]
QDate OpenP HighP LowP CloseP Vol AdjP
1 12/14/2006, 141.86, 143.24, 141.84, 143.12...
2011 Apr 09
1
How do I make this faster?
...ough parallelisation, or by
making changes. I've marked the places where Rprof showed me it was slowing
down:
currencyCorrelation <- function(lagtime = 1) {
require(quantmod)
dataTrack <- getSymbols(commandArgs(trailingOnly=T)[1], from='2009-11-21',
to='2011-04-03')
stockData <- get(dataTrack)
currencies <- row.names(oanda.currencies[grep(pattern='oz.', fixed=T, x
=as.vector(oanda.currencies$oanda.df.1.length.oanda.df...2....1.)) == F])
correlations <- vector()
values <- list()
# optimise these loops using the apply family
for (i in currenc...