Hi Everyone, I'm currently using the latest build of R and R-Studio server (both are amazing products)
I'm still very new to this but I came across this issue: I'm trying to do a select from postgres and put the data into and xts object like so: # Libs library('RPostgreSQL') # http://code.google.com/p/rpostgresql/ library('quantmod') library('TTR') library('xts') # http://cran.r-project.org/web/packages/xts/vignettes/xts.pdf # Connect and get data drv <- dbDriver('PostgreSQL') db <- dbConnect(drv, host='localhost', user='postgres', dbname='technica', password='password') fr <- dbGetQuery(db, 'SELECT date as "Date", open as "Open", high as "High", low as "Low", close as "Close", volume as "Volume", random() as "Adjusted" FROM stocks s INNER JOIN historical_prices hp ON s.id = hp.stock_id WHERE s.symbol = \'SDL\' ORDER BY date DESC limit 50') # copied from the mysql code in the quantmod source fr <- data.frame(fr[,-1],row.names=fr[,1]) fr <- xts(as.matrix(fr[,-1]), order.by=as.Date(fr[,1], origin='1970-01-01'), src='technica', updated=Sys.time()) colnames(fr) <- paste('SDL', c('Open','High','Low','Close','Volume','Adjusted'), sep='.') dvi <- DVI(Cl(fr)) print(dvi) When the code is executed I receive the error for the line dvi <- DVI(Cl(fr)): "Error in runSum(x, n) : Invalid 'n'" But if I do this (fetch the data from yahoo): getSymbols("SDL.AX") dvi <- DVI(Cl(SDL.AX)) print(dvi) All seems to work fine, but I cant see any difference when I print the two data sets out, except the data set size. Any ideas what I'm doing wrong? Id really like to be able to import from my postgres database. Also i would be happy to write a postgres routine and submit it to quantmod if i get this working Thanks! Max [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.