similar to: question on lag.zoo

Displaying 20 results from an estimated 5000 matches similar to: "question on lag.zoo"

2018 Jan 28
0
Plotting quarterly time series
On Sun, 28 Jan 2018, phil at philipsmith.ca wrote: > I have a data set with quarterly time series for several variables. The > time index is recorded in column 1 of the dataframe as a character > vector "Q1 1961", "Q2 1961","Q3 1961", "Q4 1961", "Q1 1962", etc. I want > to produce line plots with ggplot2, but it seems I need to
2018 Jan 28
2
Plotting quarterly time series
I have a data set with quarterly time series for several variables. The time index is recorded in column 1 of the dataframe as a character vector "Q1 1961", "Q2 1961","Q3 1961", "Q4 1961", "Q1 1962", etc. I want to produce line plots with ggplot2, but it seems I need to convert the time index from character to date class. Is that right? If so, how
2018 Jan 28
1
Plotting quarterly time series
Using Achim's d this also works to generate z where FUN is a function used to transform the index column and format is also passed to FUN. z <- read.zoo(d, index = "time", FUN = as.yearqtr, format = "Q%q %Y") On Sun, Jan 28, 2018 at 4:53 PM, Achim Zeileis <Achim.Zeileis at uibk.ac.at> wrote: > On Sun, 28 Jan 2018, phil at philipsmith.ca wrote: > >> I
2012 Apr 12
4
Definition of "lag" is opposite in ts and xts objects!
Example: Will ts objects be obsolete or modified? > a [,1] 1983 Q1 2.747365190 1983 Q2 2.791594762 1983 Q3 -0.009953715 1983 Q4 -0.015059485 1984 Q1 -1.190061246 1984 Q2 -0.553031799 1984 Q3 0.686874720 1984 Q4 0.953911035> lag(a,4) [,1] 1983 Q1 NA 1983 Q2 NA 1983 Q3 NA 1983 Q4 NA 1984 Q1 2.747365190 1984 Q2
2005 May 10
1
Aggregate lag
hello, Does anybody know how to aggregate a lag series ? when I try to use aggregate I get the following message > try<-ts(1:100,start=c(1985,1),freq=12) > aggregate(try,4,mean,na.rm=T) Qtr1 Qtr2 Qtr3 Qtr4 1985 2 5 8 11 1986 14 17 20 23 1987 26 29 32 35 1988 38 41 44 47 1989 50 53 56 59 1990 62 65 68 71 1991 74 77 80 83 1992
2010 Mar 11
4
Forecast
sample report data that i want to forecast quarter quarter_index Revenue 2007 Q1 1 $3,856,799 2007 Q2 2 $4,243,328 2007 Q3 3 $4,930,369 2007 Q4 4 $5,443,579 2008 Q1 5 $5,164,830 2008 Q2 6 $5,104,413 2008 Q3 7
2012 Feb 03
3
Cannot get "==" operator to return TRUE
I have a data.frame named "df". The dput of df is at the bottom of this e-mail. What I'd like to do is replace the "n/a " values with NA. On Mac OSX, it works to do this: df[df == "n/a"] <- NA However, it does not work on Ubuntu. See below. Thanks in advance, Garrett > x <- df[27, 4] # complete data.frame dput is below > dput(x) "n/a?"
2010 Mar 10
3
see the example and help me
sample report data that i want to forecast quarter quarter_index Revenue 2007 Q1 1 $3,856,799 2007 Q2 2 $4,243,328 2007 Q3 3 $4,930,369 2007 Q4 4 $5,443,579 2008 Q1 5 $5,164,830 2008 Q2 6 $5,104,413 2008 Q3 7
2005 Nov 12
1
computation on a table
Hello, I have a table (1) of the form q1 q3 q4 q8 q9 A 5 2 0 1 3 B 2 0 2 4 4 I have another table (2): q1 q2 q3 q4 q5 q6 q7 q8 q9 C 10 7 4 2 6 9 3 1 2 I would like to divide the numbers in table (1) by the number of the appropriate column in table (2): q1 q3 q4 q8 q9 A 5/10 2/4 0/2 1/1 3/2 B 2/10 0/4 2/2 4/1 4/2
2009 Feb 19
2
table with 3 variables
I have the initial matrice: > *data.frame(Subject=rep(100:101, each=4), Quarter=rep(paste("Q",1:4, sep=""),2), Boolean = rep(c("Y","N"),4))* Subject Quarter Boolean 1 100 Q1 Y 2 100 Q2 N 3 100 Q3 Y 4 100 Q4 N 5 101 Q1 Y 6 101 Q2 N 7 101 Q3 Y 8 101
2010 Jun 08
2
Extract/format/show for S4 objects
Hi all, I'm trying to make an integer-backed quarter (as in fraction of year) class, but I can't quite it to work. I want integer-backed so I don't have to worry about floating-point effects when doing math, and so that I can use it as in data.table. First of all, is there a good reference for this anywhere? All of the S4 tutorials that I've found have been too high-level, and
2008 Jan 10
1
question about subset and join ts object(s)
Hi, I have two questions about ts. (1) How do I subset a ts object and still preserve the time index? for example: > x=ts(1:10, frequency = 4, start = c(1959, 2)) # the ts object > x Qtr1 Qtr2 Qtr3 Qtr4 1959 1 2 3 1960 4 5 6 7 1961 8 9 10 I don't want the 1st 2 elements, so I could subset like this: > x[3:length(x)] [1] 3 4 5 6 7 8 9 10
2008 Feb 01
2
the "union" of several data frame rows
Hi, I have a question about how to obtain the union of several data frame rows. I'm trying to create a common key for several tests composed of different items. Here is a small scale version of the problem. These are keys for 4 different tests, not all mutually exclusive: id q1 q2 q3 q4 q5 q6 1 A C 2 B D 3 A D B 4 C D B D I would like
2009 Feb 19
2
table with 3 varialbes
I have the initial matrice: > *data.frame(Subject=rep(100:101, each=4), Quarter=rep(paste("Q",1:4, sep=""),2), Boolean = rep(c("Y","N"),4))* Subject Quarter Boolean 1 100 Q1 Y 2 100 Q2 N 3 100 Q3 Y 4 100 Q4 N 5 101 Q1 Y 6 101 Q2 N 7 101 Q3 Y 8 101
2011 Jul 06
3
Tables and merge
----- Original Message ----- From: "Silvano" <silvano at uel.br> To: <r-help at r-project.org> Sent: Thursday, June 30, 2011 9:07 AM Subject: Tables and merge > Hi, > > I have 21 files which is common variable CODE. > Each file refers to a question. > > I would like to join the 21 files into one, to construct > tables for each question by CODE. >
2011 Mar 14
2
data.frame transformation
Hi R users, I have following data frame df<-data.frame(q1=c(0,0,33.33,"check"),q2=c(0,33.33,"check",9.156), q3=c("check","check",25,100),q4=c(7.123,35,100,"check")) and i would like to replace every element that is less then 10 with . (dot) in order to obtain this: q1 q2 q3 q4 1 . . check . 2 . 33.33 check 35
2009 Jul 11
3
Reading data entered within an R program
Dear R-helpers, I know of two ways to reading data within an R program, using textConnection and stdin (demo program below). I've Googled about and looked in several books for comparisons of the two approaches but haven't found anything. Are there any particular advantages or disadvantages to these two approaches? If you were teaching R beginners, which would you present? Thanks, Bob
2012 Dec 17
1
subset handling
Dear Rui and UseRs,[a text file has also been attached, in case the format of my email is difficult to get]I am extremely sorry that I am bothering you once again, but I?ll have to get to the bottom of it. The following command sp <- lapply(split(agg, agg$st), function(x) x[order(x$year, x$month), ]) gave me an output with monthly mean of population(as under). i am not able to apply
2006 Dec 03
1
passing an argument to a function which is also to be a dataframe column name
any suggestions on the following gratefully welcome, I have a dataframe, which I am subsetting via labels atpi[, creativity] where (for example) atpi = as.data.frame(matrix(1:50, ncol = 5, nrow = 10)) names(atpi) = c("Q1", "Q2", "Q3", "Q4", "Q5") and creativity = c("Q1", "Q3", "Q4") I want to add an extra column
2012 Jan 25
2
having a bit of regression trouble
I got the code for how to do regression without an intercept out of the back of my book and the next part of the homework asks me to do it with an intercept. The problem is, Q1 disappears whenever I try. Here is my code: Without the intercept: load("tsa3.rda") > > Q=factor(rep(1:4,21)) > reg=lm(log(jj)~0+trend+Q,na.action=NULL) > model.matrix(reg) trend Q1 Q2 Q3 Q4 1