[R] Time Series

arun smartpink111 at yahoo.com
Tue Jun 3 15:46:17 CEST 2014



Hi Wayne,

As John mentioned, it is not clear about your expectations.  May be this helps:
library(xts)
x2New <- xts(test[,-1], order.by=test[,1])
library(xtsExtra)
plot(x2New,screens=1,auto.legend=TRUE)

A.K.




On Tuesday, June 3, 2014 9:29 AM, John Kane <jrkrideau at inbox.com> wrote:
I know essentially nothing about plotting time series so so I just let it pass hoping someone with knowledge of time series would help

What were you expecting to get? Just plotting the time series without labels etc, since I am getting some weird error messages about pch having a “unexpected ',' in " pch="16" and I am too lazy to bother debugging it I get a four panel plot (see attached). This does not seem make any sense to me since I don't see why Date is plotted, but as I say I know nothing about time series.

However the data did come through okay. Presumably test$Date is a date. It reads in as a factor for me which is one reason for using dput() which maintains the structure of the data.

Below is what I think your data looks like in dput() format.

Sorry not to be of more help.

test <- structure(list(Date = structure(c(15657, 15664, 15678, 15700, 15713, 15720, 15734, 15741, 15755, 15769, 15783, 15790, 15811, 15832, 15839, 15853, 15867, 15880, 15895, 15902, 15916, 15930, 15944, 15951, 15958, 15965, 15972, 15979, 15986, 16000, 16014, 16021, 16028, 16035, 16042, 16049, 16056, 16065, 16077, 16084, 16091, 16105, 16112, 16126, 16141, 16147, 16154, 16161, 16175, 16189, 16203), class = "Date"), Inr = c(2.2, 2.5, 2.4, 2.3, 2.1, 1.9, 1.9, 3.3, 2.6, 2.7, 3.1, 2.4, 2, 2.5, 2.3, 2.4, 2.3, 2.3, 2.1, 2.4, 3.6, 3, 1.3, 2.6, 1.9, 3.4, 2.4, 2.2, 2.9, 2.8, 2.1, 2.2, 2.2, 3, 2.7, 2.3, 2.7, 2.9, 2.7, 2.6, 2.6, 3.3, 2.6, 2.8, 2.9, 3.5, 2.8, 2.7, 2.5, 2.8, 2.3), Wdose = c(30, 32.5, 32.5, 35, 35, 35, 25, 40, 37.5, 37.5, 37.5, 32.5, 37.5, 35, 35, 35, 35, 35, 35, 42.5, 40, 35, 25, 40, 32.5, 35, 32.5, 35, 37.5, 35, 35, 37.5, 37.5, 40, 37.5, 37.5, 40, 40, 40, 40, 37.5, 37.5, 40, 37.5, 40, 40, 32.5, 35, 35, 35, 35), Deldose = c(NA, 2.5, 0, 2.5, 0, 0, -10,
 15, -2.7, 0, 0, -5, 5, -2.5, 0, 0, 0, 0, 0, 7.5, -2.5, -5, -10, 15, -7.5, 2.5, -2.5, 2.5, 2.5, -2.5, 0, 2.5, 0, 2.5, -2.5, 0, 2.5, 0, 0, 0, -2.5, 0, 2.5, -2.5, 2.5, 0, -7.5, 2.5, 0, 0, 0)), .Names = c("Date", "Inr", "Wdose", "Deldose"), row.names = c(NA, -51L), class = "data.frame")


John Kane
Kingston ON Canada

-----Original Message-----
From: schmtzway at yahoo.com
Sent: Mon, 2 Jun 2014 08:06:33 -0700 (PDT)
To: jrkrideau at inbox.com, r-help at r-project.org
Subject: Re: [R] Time Series

John:

The data that I sent you did you receive it? If so what thoughts or suggestions do you have for plotting the time series?

I am not sure what is going wrong and getting multi plot of same.

Thank you

Wayne Schlemitz

schmtzway at yahoo.com

  On Saturday, May 24, 2014 11:34 AM, John Kane <jrkrideau at inbox.com> wrote:

No raw data.  Sent is as text (csv) or use dput() to include it in the email.

John Kane
Kingston ON Canada

> -----Original Message-----
> From: schmtzway at yahoo.com
> Sent: Fri, 23 May 2014 08:02:31 -0700 (PDT)
> To: r-help at r-project.org
> Subject: [R] Time Series
> 
> Dear Sir:
> I am trying to plot a time series from the following code:
> 
> test <- read.table("/home/wayne/inr2a.txt", header = TRUE, quote="", sep
> = ";")
> x2 <- ts(data=test, frequency = 80, start = c(2012,11), end = c(2014,5))
> plot.ts(x2, xlab="Date", ylab="Inr", main="X2 - Time Series",
> ylim=c(1.0,4.0),pch=16, col="black")
> 
> What I get is multi plots that print 3x across the plot.
> 
> Using R 2.15.2-1 on Ubuntu Natty
> Attached is the raw data.
> 
> Thank you for any suggestions.
> Wayne
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help [https://stat.ethz.ch/mailman/listinfo/r-help]
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html [http://www.r-project.org/posting-guide.html]
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
Protect your computer files with professional cloud backup.
Get PCRx Backup and upload unlimited files automatically. 
Learn more at http://backup.pcrx.com/mail [http://backup.pcrx.com/mail]

____________________________________________________________
Protect your computer files with professional cloud backup.
Get PCRx Backup and upload unlimited files automatically. 
Learn more at http://backup.pcrx.com/mail
______________________________________________
R-help at 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.



More information about the R-help mailing list