similar to: Creating regularly spaced time series from irregular one

Displaying 20 results from an estimated 1000 matches similar to: "Creating regularly spaced time series from irregular one"

2012 Jul 02
2
using "na.locf" from package zoo to fill NA gaps
Hi everybody, I have a small question about the function "na.locf" from the package "zoo". I saw in the help that this function is able to fill NA gaps with the last value before the NA gap (or with the next value). But it is possible to fill my NA gaps according to the last AND the next value at the same time? Actually, I want R to fill my gaps with the method of
2006 Jun 07
1
Help with selecting data from irregular time series {its} objects
If I understood correctly in irregular time series (its) objects, values are indexed by time stamps in POSIX format. But if I try to select the value of my time series corresponding to specific time stamp in the following way: x - its object i <- as.POSIXct("2006-05-19 15:30:00") x[i,] or x[i] or x[i,1] I get the error message: subscript out of bounds. If I use integers: x[1,1] it
2011 Sep 30
1
last observation carried forward +1
Hi R-helpers I'm looking for a vectorised function which does missing value replacement as in last observation carried forward in the zoo package but instead of a locf, I would like the locf function to add +1 to each time a missing value occurred. See below for an example. > require(zoo) > x <- 5:15 > x[4:7] <- NA > coredata(na.locf(zoo(x))) [1] 5 6 7 7 7 7 7 12 13
2013 Mar 18
2
data.frame with NA
I have this little data.frame http://dl.dropbox.com/u/102669/nanotna.rdata Two column contains NA, so the best thing to do is use na.locf function (with fromLast = T) But locf function doesn't work because NA in my data.frame are not recognized as real NA. Is there a way to substitute fake NA with real NA? In this case na.locf function should work Thank you
2006 Feb 06
5
lme4: Error in getResponseFormula(form) : "Form" must be a two sided formula
I'm sure I'm being stupid so flame away... R2.2.1 on Windoze (boohoo) latest updates of packages. I'm exploring a dataset (land) with three variables looking at an narrowly unbalanced two group (GROUP) ANCOVA of a randomised controlled trial analysing endpoint score (SFQ.LOCF.ENDPOINT) entering the baseline score (SFQ.BASELINE) as covariate and the following work fine: > res.same
2003 Nov 14
4
LOCF - Last Observation Carried Forward
Hi! Is there a possibilty in R to carry out LOCF (Last Observation Carried Forward) analysis or to create a new data frame (array, matrix) with LOCF? Or some helpful functions, packages? Karl --------------------------------- Gesendet von http://mail.yahoo.de Schneller als Mail - der neue Yahoo! Messenger. [[alternative HTML version deleted]]
2013 Apr 29
1
how to add new rows in a dataframe?
Hi, dat1<- read.table(text=" id??????????????? t???????????????????? scores 2???????????????? 0??????????????????????? 1.2 2???????????????? 2???????????????????????? 2.3 2???????????????? 3??????????????????????? 3.6 2???????????????? 4??????????????????????? 5.6 2???????????????? 6??????????????????????? 7.8 3???????????????? 0??????????????????????? 1.6 3????????????????
2010 Jun 03
2
moving average on irregular time series
Hi all, I wonder if there is any way to calculate a moving average on an irregular time series, or use the rollapply function in zoo? I have a set of dates where I want to check if there has been an event 14 days prior to each time point in order to mark these timepoints for removal, and can't figure out a good way to do it. Many thanks in advance! Gustaf Example data:
2011 Jan 11
1
scaling to multiple data files
Hello, I have logging information for multiple machines, which I am trying to summarize and graph. So far, I process each host individually, but I would like to summarize the user count across multiple hosts. I want to answer the question "how many unique users logged in on a certain day across a group of machines"? I'm not quite sure how to scale the data frame and analysis to
2006 Jul 20
3
Question about functions in R
I tried to make the following function: function(x, y){ dates<-intersect(x[,1],y[,1]) m<-matrix(NA,length(dates),3) m[,1]<-dates j<-1 k<-1 for(i in fdax[,1]){ if(is.element(i,dates)){ m[j,3]<-as.numeric(fdax[k,2]) j<-j+1 } k<-k+1 } return(m) } When I try to import it into R with edit( file="name.txt",
2011 Oct 08
1
Filling missing days in xts time series
Hi, I have a bunch of irregularly spaced xts time series (with a POSIX index), and I'm trying to write a function that fillls the missing days. Using a solution suggested by Gabor Grothendieck for zoo, I wrote the following: # FD: Fill missing days FD<-function(ser) {rng<-range(time(ser)) > temp<-merge(ser,xts(,seq(rng[1],rng[2],"day"))) >
2010 Jun 30
1
merge.zoo and fill
Hello again, I merge different zoo time series with prices at different dates. This returns a multivariate zoo object with NA's at various points i.e., 2010-02-28 NA NA NA NA 850.2 2444.4 NA NA NA NA NA NA NA 2010-03-01 61.1 55.3 61.5 81.24 NA NA 1712.2 3.3 11139.3 163.7 2242.4 9015.6 109.791 2010-03-31
2010 Nov 08
2
A more efficient way to roll values in an irregular time series dataset?
Does anyone recommend a more efficient way to "roll" values in a time series dataset? I merged a bunch of different time series datasets (10's of thousands of them) whose observation dates and sampling interval differ. Some time series observations are reported at the beginning of the month, some at the end, some on Mondays, some on Wednesday, some annually, etc. In the
2006 Nov 08
2
Convert ordinary dates into POSIX
Does anyone know where I can find any tool for Windows that converts dates from ordinary formats into POSIX? I need it to import sime time series from Excel into R and use them with its package. Thanks!
2010 Apr 12
1
N'th of month working day problem
Dear Gabor, Thanks for your reply. however: > tail(DJd) ^DJI.Close 2010-04-01 10927.07 2010-04-05 10973.55 2010-04-06 10969.99 2010-04-07 10897.52 2010-04-08 10927.07 *2010-04-09 10997.35* > tail(ag) 2009-11-30 10344.84 2009-12-31 10428.05 2010-01-31 10067.33 2010-02-28 10325.26 2010-03-31 10856.63 *2010-04-30 10997.35 * It seems the script "makes up"
2006 Nov 13
1
Fetching Intraday data from Bloomberg
Hi Everyone. I am downloading intraday Bloomberg data from R. The code I give is: library(zoo) library(chron) library(RBloomberg) conn<-blpConnect(show.days="trading",na.action="previous.days",periodici ty="daily") dat<-blpGetData(conn, "VG1 Index", c("LAST_PRICE"), start=as.chron(as.Date("2006-9-01",
2011 Oct 09
1
help with using last observation carried forward analysis for a clinical trial please
Hi, I have a series of id's with multiple visits and questionnaire scores. This is a clinical trial that will be analyzed using the last observation carried forward method. In other words, in order to comply with intent to treat analysis when many subjects withdraw, data points for the last visit must be generated and filled in with the last observation. The ultimate goal is to tabulate the
2011 Jul 22
1
convert TS dataframe to evenly spaced intervals?
Hi R-help, I have a dataframe consisting of a time-series [t, v]. The timestamps aren't at all evenly spaced. The values are continuous. I've been able to graph this as a step function (which is what it should be) in ggplot2, using the 'step' geom. Now I would like to take the integral of the step function. For this and other reasons, is there a way to convert this into an evenly
2006 Mar 14
5
GROUP BY and SUM
I have orders, order_items, and products. I want to collate several orders so that I can get a SUM of quantities ordered for each product etc. Can I say something like (the below gives an error on :sum, and ignores :group) OrderItem.find(:all, :sum => ''quantity'', :group => ''product_id'', :include => [:order, :product]) I want to get back a
2008 Nov 11
2
Manipulation in timeSeries object:how to use the function "applySeries" by daily?
Hi all I have some tick-by-tick data and I have calculated the intraday returns. I want to sum up the intraday squared returns to calculate the daily volatility(or daily variance). I know that the s-plus FinMerics has the function aggregateSeries function that can be apply to daily data: aggregateSeries(x, Fun, by="daily"), but the counterpart function in R:applySeries can not be apply