similar to: Need help to optimize a piece of code involving zoo objects

Displaying 20 results from an estimated 2000 matches similar to: "Need help to optimize a piece of code involving zoo objects"

2009 Jun 19
1
(FULL) Need help to optimize a piece of code involving zoo objects
(Sorry, sent the message before I finished it) Hello, everyone I have a long script that uses zoo objects. In this script I used simple moving averages and these I can very efficiently calculate with filter() functions. Now, I have to use special "exponential" moving averages, and the only way I could write the code was with a for-loop, which makes everything extremely slow. I don't
2011 Sep 27
2
Coercing a character zoo to a numeric
Dear R-helpers, It seems to me that a character zoo cannot be coerced to a numeric zoo. Below is a minimal example. Can someone tell me what I have done wrong? > z<-zoo(1:4,order.by=1:4) > coredata(z)<-as.character(coredata(z)) > str(z) ‘zoo’ series from 1 to 4 Data: chr [1:4] "1" "2" "3" "4" Index: int [1:4] 1 2 3 4 >
2006 Nov 29
2
problem with indexing a zoo object
My problem is the following : I create 2 zoo objects and then I try to subset one of them using logic. indicesthatpass is a vector of trues and falses but when I send it into bckret, it returns an empty bckret. Obviously it has something to do with bckret being a zoo object and if I do the same subsctripting off of coredata(bckret), I'm confident it will work. But, I need to keep the minute
2006 Nov 23
1
Problem with as.ts(zoo-object)
Dear all, I have an error message, when I try to convert a zoo object (called test) to ts (on R 2.4.0, Package zoo version 1.2-1, Windows XP) > test 1994-05-10 1994-06-09 1994-07-09 0.0024943889 0.0024881824 0.0006955831 > str(test) atomic [1:3] 0.002494 0.002488 0.000696 - attr(*, "index")=Class 'Date' num [1:3] 8895 8925 8955 > is.regular(test) [1] TRUE
2011 Jan 30
1
SMA and EMA in package TTR
Hi, Just wondering for the SMA and EMA in package TTR, is it possible to me to code it so that, say if I need to calculate SMA (x, n=100), when the sample size is less than 100, it will give me the SMA (x, k) where k is the sample size of the data? Right now it only gives me an invalid n error. Thanks! [[alternative HTML version deleted]]
2008 Oct 22
1
R 2.8.0 qqnorm produces error with object of class zoo?
Dear list-reader, by running the following script: library(zoo) sessionInfo() search() packageDescription("zoo") data(EuStockMarkets) dax <- as.zoo(EuStockMarkets[1:10, "DAX"]) daxr <- diff(log(dax)) identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr))) qqnorm(coredata(daxr)) qqnorm(daxr) qqnorm() produces an error: > qqnorm(daxr) Fehler in if (xi == xj) 0L
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 Jun 06
2
package zoo, function na.spline with option maxgap -> Error: attempt to apply non-function?
Hello, I'm trying to use na.spline (package zoo) to fill some missing data in a time series. this works fine, however, if I apply the 'maxgap' argument, I always get the error: <------ Error in na.spline.vec(x., coredata(object.), xout = xout., ...) : attempt to apply non-function ------> I couldn't find a similar error for this case in the mailing lists and zoo vignette,
2010 May 11
3
Smoothing Techniques - short stepwise functions with spikes
R Friends, I have data from which I would like to learn a more general (smoothened) trend by applying data smoothing methods. Data points follow a positive stepwise function. | x x | xxxxxxxx xxxxxxxx | x x |xxxx xxx xxxx | xxxxxxxxxxxxxxxxx | |
2000 Feb 28
1
Parser Bug Somewhere.... (PR#460)
Full_Name: John P Cavanaugh Version: .99 OS: linux Submission from: (NULL) (24.116.10.99) dataset$ema12 <- EMA (dataset$Close,12) dataset$ema26 <- EMA (dataset$Close,26) dataset$MACD_fast <- dataset$ema26 - dataset$ema12 dataset$MACD_slow <- EMA(dataset$MACD_fast,9) dataset$MACD_hist <- dataset$MACD_fast - dataset$MACD_slow # This line doesnt work!!! But... if I does work if I
2011 Jan 24
2
how to slice a zoo object
Hi Would anyone have any pointers on how to slice up a large zoo table. I have the following structure: - > str(ZOO_OBJ) ?zoo [1:632, 1:83] 30.4 30.4 30.4 30.4 30.3 ... ?- attr(*, "dimnames")=List of 2 ??..$ : NULL ??..$ : chr [1:83] "COL1" "COL2" "COL3" "COL4" ... ?- attr(*, "index")= POSIXct[1:632], format: "2009-05-01
2008 Sep 25
3
OHLC Plot with EMA in it
Hi there I have some timeseries data which I plot in a OHLC Plot. In the same plot I'd like to have the EMA of this timeseries. I tried to add the EMA point to OHLC with lines(), but this doesn't work. Has anyone an idea how to handle it? Regards, Michael Zak
2012 May 21
1
Need help in doing EMA(Exponential Mean Average).
Can somebody help me in finding package/Example in R which could do EMA(Exponential Mean Average). I installed "TTR" package but the 'EMA" function which I was trying to use is giving the following error. Error: Could not find function "EMA" Thanks & Regards, Thomas [[alternative HTML version deleted]]
2012 Apr 05
1
is parallel computing possible for 'rollapplyr' job?
  Hi,   The code below does exactly what I want in sequential mode. But, it is slow and I want to run it in parallel mode. I examined some windows version packages (parallel, snow, snowfall,..) but could not solve my specific problem. As far as I understood, either I have to write a new function like sfRollapplyr or I have to change my code in a way that it utilizes lapply, or sapply instead of
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
2023 Apr 12
1
converting a character matrix into numeric....
Dear Rui, Not working. I have entirely removed the column containing % but am still bootless: > head(coredata(INFYTX)) INFY Historical Data INFY Historical Data INFY Historical Data INFY Historical Data [1,] "47.26" "44.28" "47.56" "44.28" [2,] "46.30" "44.92"
2023 Apr 12
1
converting a character matrix into numeric....
Dear members, I have an xts object: > head(INFYTX) INFY Historical Data INFY Historical Data.1 INFY Historical Data.2 2003-04-16 "47.26" "44.28" "47.56" 2003-04-17 "46.30" "44.92" "46.53" 2003-04-21 "45.82"
2023 Apr 12
1
converting a character matrix into numeric....
?s 19:57 de 12/04/2023, akshay kulkarni escreveu: > Dear members, > I have an xts object: > >> head(INFYTX) > INFY Historical Data INFY Historical Data.1 INFY Historical Data.2 > 2003-04-16 "47.26" "44.28" "47.56" > 2003-04-17 "46.30" "44.92"
2023 Apr 12
1
converting a character matrix into numeric....
Isn't this like trying to tie up the horse after it has left the barn? Why not figure all this out _before_ converting to xts? On April 12, 2023 12:29:49 PM PDT, akshay kulkarni <akshay_e4 at hotmail.com> wrote: >Dear Rui, > Not working. I have entirely removed the column containing % but am still bootless: > >> head(coredata(INFYTX)) > INFY
2007 Mar 31
1
Problem with S4 inheritance: unexpected re-initialization?
Dear all, To explain my problem I am attaching a demonstration package "myclasspkg": I have the following two S4 classes with similar inheritance: SubSubClassA <- SubClassB <- BaseClass SubSubClassB <- SubClassB <- BaseClass In R I am calling the following functions: > library(myclasspkg) > subA <-