similar to: Simple for-loop runs out of memory

Displaying 20 results from an estimated 12000 matches similar to: "Simple for-loop runs out of memory"

2011 May 05
1
quantmod's addTA plotting functions
Hi, I'm having trouble with quantmod's addTA plotting functions. They seem to work fine when run from the command line. But when run inside a function, only the last one run is visible. Here's an example. test.addTA <- function(from = "2010-06-01") { getSymbols("^GSPC", from = from) GSPC.close <- GSPC[,"GSPC.Close"] GSPC.EMA.3
2012 Dec 06
1
Fuction Error
I'm calling a list of symbols and then using a function to build a data frame from that symbol list. It works great until I introduce this index symbol from yahoo '^GSPC'. When and index symbol is introduced I get and error which is below. > Data <- symbolFrame(symbols) Error in get(S) : object '^GSPC' not found Since R does not like the ^ in front of a name it
2011 May 07
2
Convenience-at-the-expense-of-clarity (was: quantmod's addTA plotting functions)
Thanks, Writing plot(addTA()) worked fine. I find myself with such mixed feelings about R. After finding that addTA worked fine at the command line but not in a function, I puzzled for a long time about what kind of virtual machine structure could possibly account for that. I couldn't think of any. It turns out that this isn't due to an R virtual machine structure. The reason addTA adds
2009 Aug 03
3
Help with data type
Hi there, Using a quantmod function, I calculate the daily change between two points in a time series. However, I don't think I am using the data correctly. Code: getSymbols("^GSPC", src="yahoo") CloseData <- Cl(GSPC) Delta <- diff(CloseData, lag=1) for (i in 3:length(Delta)) { if (Delta[i]>Delta[i-1]) sum <- sum + Delta } I can't seem to use the Delta
2008 Mar 31
1
download.file error
Dear all, I am looking for a way to work out if a file on the internet exists before attempting to download it using the function download.file(). For example, using a url that does not exist url <- "http://finance.yahoo.com/ftse.csv" destfile <- tempfile() download.file(url = url, destfile = destfile) # gives the following response ... trying URL
2011 Apr 29
3
why doesn't ifelse work ?
I have the following lines of code: ind <- rollapply(GSPC, 200, mean) signal <- ifelse(diff(ind, 5) > 0 , 1 , -1) signal[is.na(signal)] <- 0 I never get a value of -1 for signal even though I know diff(ind , 5) is less than zero frequently. It looks like when diff(ind , 5) is less than zero, signal gets set to 0 instead of - 1. Any ideas why ? Here's some information on ind and
2005 Sep 29
2
priceIts
Dear All, There is an example for the priceIts function (the its package) which does not work for me as expected. > ?priceIts > x1 <- priceIts(instrument = c("^ftse"), start = "1998-01-01", + quote = "Close") Error in validObject(.Object) : invalid class "its" object: Missing values in dates > x2 <-
2011 Jun 03
2
tkrplot Newbie
Hello, I am trying to write a tcltk based program that plots/manipulates xts/xoo time series objects. I have the code I used from ## http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/tkrplot.html : ## require(quantmod) require(tcltk) library(tkrplot) Sys.setenv(TZ="GMT") getSymbols("^GSPC", from = "1960-01-01") Myhscale <- 2.5 # Horizontal scaling
2010 Aug 15
2
Adding colored background area to a time series plot
Hi, I am trying to add a rectangular colored background area to a plot of a time series of relative price changes. I believe that what I'm trying to do is very similar to the question and example given here: http://www.mail-archive.com/r-help at stat.math.ethz.ch/msg73948.html http://www.mayin.org/ajayshah/KB/R/html/g5.html My problem/difference is that my time series looks like so: >
2011 Nov 10
2
Error in axis ????
I did an update of both rstudio and my packages. I had some trouble but was able to move a lot of the packages so most troubles seem to be behind me. But having a problem with code that previously ran fine. See below: require(quantmod) Loading required package: quantmod Loading required package: Defaults Loading required package: xts Loading required package: zoo Attaching package: ?zoo? The
2010 Dec 02
1
Downloading quote data from yahoo finance
Hi R users,   Thanks in advance.   I am using R 2.12.0 on Windows XP.   May I request you to assist me in the following please.   1. I am getting error while downloading quote data from yahoo finance.   The example code is below (taken from tseries help):   library(tseries)   con <- url("http://quote.yahoo.com") if(!inherits(try(open(con), silent = TRUE), "try-error")) {  
2007 Feb 19
2
Calculating the Sharpe ratio
Hi useRs, I am trying to calculate the Sharpe ratio with "sharpe" of the library "tseries". The documentation requires the univariate time series to be a portfolio's cumulated returns. In this case, the example given data(EuStockMarkets) dax <- log(EuStockMarkets[,"FTSE"]) is however not the cumulated returns but rather the daily returns of the FTSE
2018 May 31
2
How to alpha entire plot?
I have two chromatograms I want plotted on the same axes. I would like the plots to be transparent, so the first chart is not obscured. I have tried adjustcolor(..., alpha.f=0.3), the problem is that my chromatogram is so dense with datapoints that they overlap and the entire graph just ends up a solid color. The second histogram still obscures the first. Consider this example: col1 <-
2012 Mar 10
1
Generating abnormal returns in R
Hello This is my first post on this forum and I hope someone can help me out. I have a datafile (weeklyR) with returns of +- 100 companies. I acquired this computing the following code: library("tseries"); tickers = c("GSPC" , "BP" , "TOT" , "ENI.MI" , "VOW.BE" , "CS.PA" , "DAI.DE" , "ALV.DE" ,
2008 Feb 08
2
Applying lm to data with combn
http://www.nabble.com/file/p15359204/test.data.csv http://www.nabble.com/file/p15359204/test.data.csv test.data.csv Hi, I have used apply to have certian combinations, but when I try to use these combinations I get the error [Error in eval(expr, envir, enclos) : object "X.GDAXI" not found]. being a novice I donot understand that after applying combination to the data I cant access
2011 Mar 13
1
problem with looping formula through table
Dear useRs, I am stuck with a piece of code and hope you could give me some pointers. My aim is to calculate the lm-regression coefficients of individual stocks against an index. I am interested in both the coefficient and the pval. While I could do this manually for a select hand full, I hope to scale this up say for 30+ stocks (DAX-30, FTSE-100 etc.) to eventually have a matrix of coefficients
2011 May 15
4
DCC-GARCH model
Hello, I have a few questions concerning the DCC-GARCH model and its programming in R. So here is what I want to do: I take quotes of two indices - S&P500 and DJ. And the aim is to estimate coefficients of the DCC-GARCH model for them. This is how I do it: library(tseries) p1 = get.hist.quote(instrument = "^gspc",start = "2005-01-07",end =
2008 Jun 19
1
How can I shade the background area of a zoo time series object between specific dates?
Dear list members, How can I shade the background area of a zoo time series object between specific dates? eg. library(tseries) library(zoo) SP500<-get.hist.quote("^GSPC", start = "1990-01-01", quote = "Close") plot(SP500) How can I produce the same plot but with a (say) red background between 2007-04-12 and 2008-05-14 ?
2017 Jul 30
4
Kalman filter for a time series
I found an example at http://www.bearcave.com/finance/random_r_hacks/kalman_smooth.html shown below. But it seems the structSSM function has been removed from KFAS library so it won't run. Does anyone know how to fix the code so that it runs? library(KFAS) library(tseries) library(timeSeries) library(zoo) library(quantmod) getDailyPrices = function( tickerSym, startDate, endDate ) {
2012 Feb 11
1
object not found - Can not figure out why I get this error: Error in NROW(yCoordinatesOfLines) : object 'low' not found
Hi, I have been using R for over a year now. I am a very happy user. Thank you for making this happen. This is my first question to this list. I trying to add some functions to quantmod that would enable me to draw arbitrary lines and text and make sure they are redrawn. I have created following function: require(quantmod) # Add horizontal line to graph produced by quantmod::chart_Series()