Hello,
How can I convert Close colume of the below xts time series data into a list of
Close values ?
I'd like to plot Close values as a list.
> head(zc)
Close
(10/15/12 09:00:00) 252.40
(10/15/12 09:01:00) 253.10
(10/15/12 09:02:00) 253.15
(10/15/12 09:03:00) 253.30
(10/15/12 09:04:00) 253.25
(10/15/12 09:05:00) 253.45
I tried the below command to plot it. But it failed.
> plot(1:length(zc$Close),as.list(zc$Close))
Thanks in advance,
SK Park
[[alternative HTML version deleted]]
just try plot(zc$Close) Sent from my iPad On Dec 19, 2012, at 2:45, ??? <birdfire94 at naver.com> wrote:> Hello, > > > How can I convert Close colume of the below xts time series data into a list of Close values ? > I'd like to plot Close values as a list. > > > > > head(zc) > Close > (10/15/12 09:00:00) 252.40 > (10/15/12 09:01:00) 253.10 > (10/15/12 09:02:00) 253.15 > (10/15/12 09:03:00) 253.30 > (10/15/12 09:04:00) 253.25 > (10/15/12 09:05:00) 253.45 > > > I tried the below command to plot it. But it failed. > > > > plot(1:length(zc$Close),as.list(zc$Close)) > > > > Thanks in advance, > > > SK Park > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.
Hi,
I didn't understand ">".
Lines1<-textConnection("Date Time Close
10/15/12 09:00:00 252.40
10/15/12 09:01:00 253.10
10/15/12 09:02:00 253.15
10/15/12 09:03:00 253.30
10/15/12 09:04:00 253.25
10/15/12 09:05:00 253.45")
library(zoo)
library(xts)
z<- read.zoo(Lines1,header=TRUE,index=list(1,2),FUN=function(d,t)
as.chron(paste(as.Date(chron(d)),t)))
zc<-as.xts(z)
colnames(zc)<-"Close"
?zc
?# ?????????????????? Close
#(10/15/12 09:00:00) 252.40
#(10/15/12 09:01:00) 253.10
#(10/15/12 09:02:00) 253.15
#(10/15/12 09:03:00) 253.30
#(10/15/12 09:04:00) 253.25
#(10/15/12 09:05:00) 253.45
length(as.list(zc$Close))
#[1] 1
1:length(zc$Close)
#[1] 1 2 3 4 5 6
?plot(z) #works
?plot(1:length(zc$Close),split(zc$Close,row(zc))) #should also work
A.K.
----- Original Message -----
From: ??? <birdfire94 at naver.com>
To: r-help at r-project.org
Cc:
Sent: Wednesday, December 19, 2012 2:45 AM
Subject: [R] How to convert xts data into list
Hello,
How can I convert Close colume of the below xts time series data into a list of
Close values ?
I'd like to plot Close values as a list.
> head(zc)
? ? ? ? ? ? ? ? ? ? Close
(10/15/12 09:00:00) 252.40
(10/15/12 09:01:00) 253.10
(10/15/12 09:02:00) 253.15
(10/15/12 09:03:00) 253.30
(10/15/12 09:04:00) 253.25
(10/15/12 09:05:00) 253.45
I tried the below command to plot it. But it failed.
> plot(1:length(zc$Close),as.list(zc$Close))
Thanks in advance,
SK Park
??? [[alternative HTML version deleted]]
______________________________________________
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.
HI,
As I said earlier, I am able to generate the plot.
pdf("Parkplot1.pdf")
?plot(1:length(zc1$Close),split(zc1$Close,row(zc1)))
?dev.off()
#the pdf is attached.
A.K.
________________________________
From: ??? <birdfire94 at naver.com>
To: arun <smartpink111 at yahoo.com>
Sent: Wednesday, December 19, 2012 10:04 AM
Subject: Re: [R] How to convert xts data into list
Hi,
Here I pasted the dput()ed data and result of str():
Thanks,
SK Park
----------------------------------------------------------------------------->?str(zc)
An ?xts? object from (10/15/12 09:00:00) to (10/15/12 15:15:00) containing:
? Data: num [1:366, 1] 252 253 253 253 253 ...
?- attr(*, "dimnames")=List of 2
? ..$ : NULL
? ..$ : chr "Close"
? Indexed by objects of class: [chron,dates,times] TZ:?
? xts Attributes: ?
List of 2
?$ tclass: chr [1:3] "chron" "dates" "times"
?$ tzone : chr ""
> dput(zc)
structure(c(252.4, 253.1, 253.15, 253.3, 253.25, 253.45, 253.5,?
253.45, 253.2, 253.45, 253.65, 253.55, 253.4, 253.45, 253.4,?
253.15, 253, 253.05, 253.1, 252.95, 252.5, 252.5, 252.5, 252.5,?
252.25, 252.1, 252.3, 252.3, 252.2, 252.25, 252.3, 252.15, 252.4,?
252.5, 252.4, 252.4, 252.5, 252.45, 252.55, 252.5, 252.5, 252.4,?
252.4, 252.4, 252.4, 252.4, 252.5, 252.5, 252.45, 252.6, 252.9,?
252.8, 252.75, 252.95, 252.75, 253, 253.05, 253.1, 253, 253.15,?
253, 252.95, 252.95, 253.1, 253.1, 252.95, 253.15, 253.25, 253.4,?
253.7, 253.7, 253.85, 253.95, 253.85, 253.9, 253.9, 254.1, 253.95,?
253.95, 253.95, 253.9, 253.8, 253.85, 253.95, 253.9, 253.9, 253.9,?
253.95, 253.85, 253.9, 253.85, 253.55, 253.65, 253.5, 253.7,?
253.7, 253.6, 253.9, 253.85, 253.9, 253.85, 253.7, 253.6, 253.8,?
253.85, 253.75, 253.8, 253.9, 253.95, 254.55, 254.45, 254.35,?
254.3, 254.3, 254.2, 254.25, 254.1, 254.1, 254.15, 254.1, 253.9,?
253.7, 253.7, 253.6, 253.7, 253.7, 253.75, 253.75, 253.7, 253.6,?
253.7, 253.3, 253.25, 253.3, 253.2, 253.25, 253.3, 253.2, 253.25,?
253.25, 253.15, 253.05, 253, 252.8, 252.65, 252.65, 252.55, 252.7,?
252.7, 252.6, 252.75, 252.65, 252.7, 252.75, 252.75, 252.75,?
252.65, 252.7, 252.65, 252.65, 252.65, 252.9, 252.8, 252.8, 252.8,?
252.55, 252.7, 252.85, 252.85, 252.85, 252.75, 252.8, 252.8,?
252.75, 252.8, 252.75, 252.85, 252.85, 252.85, 252.85, 252.8,?
252.9, 252.85, 252.9, 252.85, 252.6, 252.75, 252.7, 252.65, 252.55,?
252.5, 252.5, 252.5, 252.4, 252.6, 252.5, 252.8, 252.75, 252.8,?
252.85, 252.8, 252.8, 252.9, 252.9, 252.9, 253.05, 252.9, 252.9,?
252.85, 252.9, 252.95, 252.9, 252.75, 252.7, 252.75, 252.8, 252.8,?
252.75, 252.65, 252.65, 252.85, 252.95, 253.05, 253, 252.95,?
252.9, 252.95, 252.95, 252.95, 252.9, 252.9, 253.15, 253.15,?
253.05, 253, 252.95, 252.85, 252.8, 253.05, 252.95, 252.9, 253,?
253.1, 252.95, 252.95, 253.05, 253, 253.1, 252.9, 252.9, 252.95,?
252.95, 252.95, 253, 252.95, 253.15, 253.1, 253.05, 253.05, 253.2,?
253.3, 253.35, 253.3, 253.3, 253.2, 253.25, 253.2, 253.2, 253.15,?
253.05, 253.05, 253.1, 253.05, 253, 253, 252.85, 252.85, 252.75,?
252.75, 252.85, 252.75, 252.75, 252.75, 252.8, 252.7, 252.7,?
252.7, 252.7, 252.7, 252.65, 252.65, 252.65, 252.65, 252.55,?
252.6, 252.8, 252.65, 252.6, 252.6, 252.65, 252.45, 252.4, 252.45,?
252.5, 252.65, 252.75, 252.7, 252.8, 252.75, 252.8, 252.7, 252.7,?
252.7, 252.8, 252.75, 252.75, 252.75, 252.65, 252.7, 252.75,?
252.7, 252.8, 252.8, 252.8, 252.75, 252.7, 252.75, 252.8, 252.8,?
253.05, 252.9, 252.75, 252.75, 252.8, 252.8, 252.65, 252.6, 252.55,?
252.55, 252.55, 252.55, 252.55, 252.7, 252.75, 252.65, 252.75,?
252.7, 252.65, 252.6, 252.6, 252.6, 252.55, 252.5, 252.6, 252.65,?
252.7, 252.7, 252.7, 252.8, 252.75, 252.85, 252.9, 252.95, 253.05,?
253.05, 253.1), class = c("xts", "zoo"), .indexCLASS =
c("chron",?
"dates", "times"), tclass = c("chron",
"dates", "times"), .indexTZ = "", tzone =
"", index = structure(c(1350259200,?
1350259260, 1350259320, 1350259380, 1350259440, 1350259500, 1350259560,?
1350259620, 1350259680, 1350259740, 1350259800, 1350259860, 1350259920,?
1350259980, 1350260040, 1350260100, 1350260160, 1350260220, 1350260280,?
1350260340, 1350260400, 1350260460, 1350260520, 1350260580, 1350260640,?
1350260700, 1350260760, 1350260820, 1350260880, 1350260940, 1350261000,?
1350261060, 1350261120, 1350261180, 1350261240, 1350261300, 1350261360,?
1350261420, 1350261480, 1350261540, 1350261600, 1350261660, 1350261720,?
1350261780, 1350261840, 1350261900, 1350261960, 1350262020, 1350262080,?
1350262140, 1350262200, 1350262260, 1350262320, 1350262380, 1350262440,?
1350262500, 1350262560, 1350262620, 1350262680, 1350262740, 1350262800,?
1350262860, 1350262920, 1350262980, 1350263040, 1350263100, 1350263160,?
1350263220, 1350263280, 1350263340, 1350263400, 1350263460, 1350263520,?
1350263580, 1350263640, 1350263700, 1350263760, 1350263820, 1350263880,?
1350263940, 1350264000, 1350264060, 1350264120, 1350264180, 1350264240,?
1350264300, 1350264360, 1350264420, 1350264480, 1350264540, 1350264600,?
1350264660, 1350264720, 1350264780, 1350264840, 1350264900, 1350264960,?
1350265020, 1350265080, 1350265140, 1350265200, 1350265260, 1350265320,?
1350265380, 1350265440, 1350265500, 1350265560, 1350265620, 1350265680,?
1350265740, 1350265800, 1350265860, 1350265920, 1350265980, 1350266040,?
1350266100, 1350266160, 1350266220, 1350266280, 1350266340, 1350266400,?
1350266460, 1350266520, 1350266580, 1350266640, 1350266700, 1350266760,?
1350266820, 1350266880, 1350266940, 1350267000, 1350267060, 1350267120,?
1350267180, 1350267240, 1350267300, 1350267360, 1350267420, 1350267480,?
1350267540, 1350267600, 1350267660, 1350267720, 1350267780, 1350267840,?
1350267900, 1350267960, 1350268020, 1350268080, 1350268140, 1350268200,?
1350268260, 1350268320, 1350268380, 1350268440, 1350268500, 1350268560,?
1350268620, 1350268680, 1350268740, 1350268800, 1350268860, 1350268920,?
1350268980, 1350269040, 1350269100, 1350269160, 1350269220, 1350269280,?
1350269340, 1350269400, 1350269460, 1350269520, 1350269580, 1350269640,?
1350269700, 1350269760, 1350269820, 1350269880, 1350269940, 1350270000,?
1350270060, 1350270120, 1350270180, 1350270240, 1350270300, 1350270360,?
1350270420, 1350270480, 1350270540, 1350270600, 1350270660, 1350270720,?
1350270780, 1350270840, 1350270900, 1350270960, 1350271020, 1350271080,?
1350271140, 1350271200, 1350271260, 1350271320, 1350271380, 1350271440,?
1350271500, 1350271560, 1350271620, 1350271680, 1350271740, 1350271800,?
1350271860, 1350271920, 1350271980, 1350272040, 1350272100, 1350272160,?
1350272220, 1350272280, 1350272340, 1350272400, 1350272460, 1350272520,?
1350272580, 1350272640, 1350272700, 1350272760, 1350272820, 1350272880,?
1350272940, 1350273000, 1350273060, 1350273120, 1350273180, 1350273240,?
1350273300, 1350273360, 1350273420, 1350273480, 1350273540, 1350273600,?
1350273660, 1350273720, 1350273780, 1350273840, 1350273900, 1350273960,?
1350274020, 1350274080, 1350274140, 1350274200, 1350274260, 1350274320,?
1350274380, 1350274440, 1350274500, 1350274560, 1350274620, 1350274680,?
1350274740, 1350274800, 1350274860, 1350274920, 1350274980, 1350275040,?
1350275100, 1350275160, 1350275220, 1350275280, 1350275340, 1350275400,?
1350275460, 1350275520, 1350275580, 1350275640, 1350275700, 1350275760,?
1350275820, 1350275880, 1350275940, 1350276000, 1350276060, 1350276120,?
1350276180, 1350276240, 1350276300, 1350276360, 1350276420, 1350276480,?
1350276540, 1350276600, 1350276660, 1350276720, 1350276780, 1350276840,?
1350276900, 1350276960, 1350277020, 1350277080, 1350277140, 1350277200,?
1350277260, 1350277320, 1350277380, 1350277440, 1350277500, 1350277560,?
1350277620, 1350277680, 1350277740, 1350277800, 1350277860, 1350277920,?
1350277980, 1350278040, 1350278100, 1350278160, 1350278220, 1350278280,?
1350278340, 1350278400, 1350278460, 1350278520, 1350278580, 1350278640,?
1350278700, 1350278760, 1350278820, 1350278880, 1350278940, 1350279000,?
1350279060, 1350279120, 1350279180, 1350279240, 1350279300, 1350279360,?
1350279420, 1350279480, 1350279540, 1350279600, 1350279660, 1350279720,?
1350279780, 1350279840, 1350279900, 1350279960, 1350280020, 1350280080,?
1350280140, 1350280200, 1350280260, 1350280320, 1350280380, 1350280440,?
1350280500, 1350280560, 1350280620, 1350280680, 1350280740, 1350280800,?
1350280860, 1350280920, 1350280980, 1350281040, 1350281700), tzone =
"", tclass = c("chron",?
"dates", "times")), .Dim = c(366L, 1L), .Dimnames =
list(NULL,?
? ? "Close"))
-----------------------------------------------------------------------------
-----Original Message-----
From: "arun"<smartpink111 at yahoo.com>
To: "???"<birdfire94 at naver.com>;
Cc:
Sent: 2012-12-20 (?) 00:00:24
Subject: Re: [R] How to convert xts data into list
HI,
I don't know how the structure of your xts data looks like.? I was assuming
that this was the way you created the xts object.
If you dput() the data, I would be happy to check it.? BTW, are you saying that
the example dataset that I provided did not work?? It worked for me.
A.K.
________________________________
From: ??? <birdfire94>@naver.com>
To: arun <smartpink111>@yahoo.com>
Sent: Wednesday, December 19, 2012 8:31 AM
Subject: Re: [R] How to convert xts data into list
Hi,
Thanks for reply.?But I still failed to plot it.?
I also found another way to plot it.
I converted xts data frame into matrix, and again matrix into list referencing
the following link.
http://www.statmethods.net/management/typeconversion.html
mat <- as.matrix(zc)
vec <- as.vector(mat)
plot(vec)
SK Park
-----Original Message-----
From: "arun"<smartpink111>@yahoo.com>
To: "???"<birdfire94>@naver.com>;
Cc: "R help"<r-help>@r-project.org>;
Sent: 2012-12-19 (?) 22:07:46
Subject: Re: [R] How to convert xts data into list
Hi,
I didn't understand ">".
Lines1<-textConnection("Date Time Close
10/15/12 09:00:00 252.40
10/15/12 09:01:00 253.10
10/15/12 09:02:00 253.15
10/15/12 09:03:00 253.30
10/15/12 09:04:00 253.25
10/15/12 09:05:00 253.45")
library(zoo)
library(xts)
z<- read.zoo(Lines1,header=TRUE,index=list(1,2),FUN=function(d,t)
as.chron(paste(as.Date(chron(d)),t)))
zc<-as.xts(z)
colnames(zc)<-"Close"
?zc
?# ?????????????????? Close
#(10/15/12 09:00:00) 252.40
#(10/15/12 09:01:00) 253.10
#(10/15/12 09:02:00) 253.15
#(10/15/12 09:03:00) 253.30
#(10/15/12 09:04:00) 253.25
#(10/15/12 09:05:00) 253.45
length(as.list(zc$Close))
#[1] 1
1:length(zc$Close)
#[1] 1 2 3 4 5 6
?plot(z) #works
?plot(1:length(zc$Close),split(zc$Close,row(zc))) #should also work
A.K.
----- Original Message -----
From: ??? <birdfire94>@naver.com>
To: r-help at r-project.org
Cc:
Sent: Wednesday, December 19, 2012 2:45 AM
Subject: [R] How to convert xts data into list
Hello,
How can I convert Close colume of the below xts time series data into a list of
Close values ?
I'd like to plot Close values as a list.
> head(zc)
? ? ? ? ? ? ? ? ? ???Close
(10/15/12 09:00:00) 252.40
(10/15/12 09:01:00) 253.10
(10/15/12 09:02:00) 253.15
(10/15/12 09:03:00) 253.30
(10/15/12 09:04:00) 253.25
(10/15/12 09:05:00) 253.45
I tried the below command to plot it. But it failed.
> plot(1:length(zc$Close),as.list(zc$Close))
Thanks in advance,
SK Park
??? [[alternative HTML version deleted]]
______________________________________________
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Parkplot1.pdf
Type: application/pdf
Size: 6616 bytes
Desc: not available
URL:
<https://stat.ethz.ch/pipermail/r-help/attachments/20121219/43626ca6/attachment-0002.pdf>
Thank you for your help.
Now it works.
SK Park
-----Original Message-----
From: "arun"<smartpink111@yahoo.com>
To: "박상규"<birdfire94@naver.com>;
Cc: "R help"<r-help@r-project.org>;
Sent: 2012-12-20 (목) 00:13:40
Subject: Re: [R] How to convert xts data into list
HI,
As I said earlier, I am able to generate the plot.
pdf("Parkplot1.pdf")
plot(1:length(zc1$Close),split(zc1$Close,row(zc1)))
dev.off()
#the pdf is attached.
A.K.
________________________________
From: 박상규 <birdfire94>@naver.com>
To: arun <smartpink111>@yahoo.com>
Sent: Wednesday, December 19, 2012 10:04 AM
Subject: Re: [R] How to convert xts data into list
Hi,
Here I pasted the dput()ed data and result of str():
Thanks,
SK Park
-----------------------------------------------------------------------------
> str(zc)
An ‘xts’ object from (10/15/12 09:00:00) to (10/15/12 15:15:00) containing:
Data: num [1:366, 1] 252 253 253 253 253 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr "Close"
Indexed by objects of class: [chron,dates,times] TZ:
xts Attributes:
List of 2
$ tclass: chr [1:3] "chron" "dates" "times"
$ tzone : chr ""
> dput(zc)
structure(c(252.4, 253.1, 253.15, 253.3, 253.25, 253.45, 253.5,
253.45, 253.2, 253.45, 253.65, 253.55, 253.4, 253.45, 253.4,
253.15, 253, 253.05, 253.1, 252.95, 252.5, 252.5, 252.5, 252.5,
252.25, 252.1, 252.3, 252.3, 252.2, 252.25, 252.3, 252.15, 252.4,
252.5, 252.4, 252.4, 252.5, 252.45, 252.55, 252.5, 252.5, 252.4,
252.4, 252.4, 252.4, 252.4, 252.5, 252.5, 252.45, 252.6, 252.9,
252.8, 252.75, 252.95, 252.75, 253, 253.05, 253.1, 253, 253.15,
253, 252.95, 252.95, 253.1, 253.1, 252.95, 253.15, 253.25, 253.4,
253.7, 253.7, 253.85, 253.95, 253.85, 253.9, 253.9, 254.1, 253.95,
253.95, 253.95, 253.9, 253.8, 253.85, 253.95, 253.9, 253.9, 253.9,
253.95, 253.85, 253.9, 253.85, 253.55, 253.65, 253.5, 253.7,
253.7, 253.6, 253.9, 253.85, 253.9, 253.85, 253.7, 253.6, 253.8,
253.85, 253.75, 253.8, 253.9, 253.95, 254.55, 254.45, 254.35,
254.3, 254.3, 254.2, 254.25, 254.1, 254.1, 254.15, 254.1, 253.9,
253.7, 253.7, 253.6, 253.7, 253.7, 253.75, 253.75, 253.7, 253.6,
253.7, 253.3, 253.25, 253.3, 253.2, 253.25, 253.3, 253.2, 253.25,
253.25, 253.15, 253.05, 253, 252.8, 252.65, 252.65, 252.55, 252.7,
252.7, 252.6, 252.75, 252.65, 252.7, 252.75, 252.75, 252.75,
252.65, 252.7, 252.65, 252.65, 252.65, 252.9, 252.8, 252.8, 252.8,
252.55, 252.7, 252.85, 252.85, 252.85, 252.75, 252.8, 252.8,
252.75, 252.8, 252.75, 252.85, 252.85, 252.85, 252.85, 252.8,
252.9, 252.85, 252.9, 252.85, 252.6, 252.75, 252.7, 252.65, 252.55,
252.5, 252.5, 252.5, 252.4, 252.6, 252.5, 252.8, 252.75, 252.8,
252.85, 252.8, 252.8, 252.9, 252.9, 252.9, 253.05, 252.9, 252.9,
252.85, 252.9, 252.95, 252.9, 252.75, 252.7, 252.75, 252.8, 252.8,
252.75, 252.65, 252.65, 252.85, 252.95, 253.05, 253, 252.95,
252.9, 252.95, 252.95, 252.95, 252.9, 252.9, 253.15, 253.15,
253.05, 253, 252.95, 252.85, 252.8, 253.05, 252.95, 252.9, 253,
253.1, 252.95, 252.95, 253.05, 253, 253.1, 252.9, 252.9, 252.95,
252.95, 252.95, 253, 252.95, 253.15, 253.1, 253.05, 253.05, 253.2,
253.3, 253.35, 253.3, 253.3, 253.2, 253.25, 253.2, 253.2, 253.15,
253.05, 253.05, 253.1, 253.05, 253, 253, 252.85, 252.85, 252.75,
252.75, 252.85, 252.75, 252.75, 252.75, 252.8, 252.7, 252.7,
252.7, 252.7, 252.7, 252.65, 252.65, 252.65, 252.65, 252.55,
252.6, 252.8, 252.65, 252.6, 252.6, 252.65, 252.45, 252.4, 252.45,
252.5, 252.65, 252.75, 252.7, 252.8, 252.75, 252.8, 252.7, 252.7,
252.7, 252.8, 252.75, 252.75, 252.75, 252.65, 252.7, 252.75,
252.7, 252.8, 252.8, 252.8, 252.75, 252.7, 252.75, 252.8, 252.8,
253.05, 252.9, 252.75, 252.75, 252.8, 252.8, 252.65, 252.6, 252.55,
252.55, 252.55, 252.55, 252.55, 252.7, 252.75, 252.65, 252.75,
252.7, 252.65, 252.6, 252.6, 252.6, 252.55, 252.5, 252.6, 252.65,
252.7, 252.7, 252.7, 252.8, 252.75, 252.85, 252.9, 252.95, 253.05,
253.05, 253.1), class = c("xts", "zoo"), .indexCLASS =
c("chron",
"dates", "times"), tclass = c("chron",
"dates", "times"), .indexTZ = "", tzone =
"", index = structure(c(1350259200,
1350259260, 1350259320, 1350259380, 1350259440, 1350259500, 1350259560,
1350259620, 1350259680, 1350259740, 1350259800, 1350259860, 1350259920,
1350259980, 1350260040, 1350260100, 1350260160, 1350260220, 1350260280,
1350260340, 1350260400, 1350260460, 1350260520, 1350260580, 1350260640,
1350260700, 1350260760, 1350260820, 1350260880, 1350260940, 1350261000,
1350261060, 1350261120, 1350261180, 1350261240, 1350261300, 1350261360,
1350261420, 1350261480, 1350261540, 1350261600, 1350261660, 1350261720,
1350261780, 1350261840, 1350261900, 1350261960, 1350262020, 1350262080,
1350262140, 1350262200, 1350262260, 1350262320, 1350262380, 1350262440,
1350262500, 1350262560, 1350262620, 1350262680, 1350262740, 1350262800,
1350262860, 1350262920, 1350262980, 1350263040, 1350263100, 1350263160,
1350263220, 1350263280, 1350263340, 1350263400, 1350263460, 1350263520,
1350263580, 1350263640, 1350263700, 1350263760, 1350263820, 1350263880,
1350263940, 1350264000, 1350264060, 1350264120, 1350264180, 1350264240,
1350264300, 1350264360, 1350264420, 1350264480, 1350264540, 1350264600,
1350264660, 1350264720, 1350264780, 1350264840, 1350264900, 1350264960,
1350265020, 1350265080, 1350265140, 1350265200, 1350265260, 1350265320,
1350265380, 1350265440, 1350265500, 1350265560, 1350265620, 1350265680,
1350265740, 1350265800, 1350265860, 1350265920, 1350265980, 1350266040,
1350266100, 1350266160, 1350266220, 1350266280, 1350266340, 1350266400,
1350266460, 1350266520, 1350266580, 1350266640, 1350266700, 1350266760,
1350266820, 1350266880, 1350266940, 1350267000, 1350267060, 1350267120,
1350267180, 1350267240, 1350267300, 1350267360, 1350267420, 1350267480,
1350267540, 1350267600, 1350267660, 1350267720, 1350267780, 1350267840,
1350267900, 1350267960, 1350268020, 1350268080, 1350268140, 1350268200,
1350268260, 1350268320, 1350268380, 1350268440, 1350268500, 1350268560,
1350268620, 1350268680, 1350268740, 1350268800, 1350268860, 1350268920,
1350268980, 1350269040, 1350269100, 1350269160, 1350269220, 1350269280,
1350269340, 1350269400, 1350269460, 1350269520, 1350269580, 1350269640,
1350269700, 1350269760, 1350269820, 1350269880, 1350269940, 1350270000,
1350270060, 1350270120, 1350270180, 1350270240, 1350270300, 1350270360,
1350270420, 1350270480, 1350270540, 1350270600, 1350270660, 1350270720,
1350270780, 1350270840, 1350270900, 1350270960, 1350271020, 1350271080,
1350271140, 1350271200, 1350271260, 1350271320, 1350271380, 1350271440,
1350271500, 1350271560, 1350271620, 1350271680, 1350271740, 1350271800,
1350271860, 1350271920, 1350271980, 1350272040, 1350272100, 1350272160,
1350272220, 1350272280, 1350272340, 1350272400, 1350272460, 1350272520,
1350272580, 1350272640, 1350272700, 1350272760, 1350272820, 1350272880,
1350272940, 1350273000, 1350273060, 1350273120, 1350273180, 1350273240,
1350273300, 1350273360, 1350273420, 1350273480, 1350273540, 1350273600,
1350273660, 1350273720, 1350273780, 1350273840, 1350273900, 1350273960,
1350274020, 1350274080, 1350274140, 1350274200, 1350274260, 1350274320,
1350274380, 1350274440, 1350274500, 1350274560, 1350274620, 1350274680,
1350274740, 1350274800, 1350274860, 1350274920, 1350274980, 1350275040,
1350275100, 1350275160, 1350275220, 1350275280, 1350275340, 1350275400,
1350275460, 1350275520, 1350275580, 1350275640, 1350275700, 1350275760,
1350275820, 1350275880, 1350275940, 1350276000, 1350276060, 1350276120,
1350276180, 1350276240, 1350276300, 1350276360, 1350276420, 1350276480,
1350276540, 1350276600, 1350276660, 1350276720, 1350276780, 1350276840,
1350276900, 1350276960, 1350277020, 1350277080, 1350277140, 1350277200,
1350277260, 1350277320, 1350277380, 1350277440, 1350277500, 1350277560,
1350277620, 1350277680, 1350277740, 1350277800, 1350277860, 1350277920,
1350277980, 1350278040, 1350278100, 1350278160, 1350278220, 1350278280,
1350278340, 1350278400, 1350278460, 1350278520, 1350278580, 1350278640,
1350278700, 1350278760, 1350278820, 1350278880, 1350278940, 1350279000,
1350279060, 1350279120, 1350279180, 1350279240, 1350279300, 1350279360,
1350279420, 1350279480, 1350279540, 1350279600, 1350279660, 1350279720,
1350279780, 1350279840, 1350279900, 1350279960, 1350280020, 1350280080,
1350280140, 1350280200, 1350280260, 1350280320, 1350280380, 1350280440,
1350280500, 1350280560, 1350280620, 1350280680, 1350280740, 1350280800,
1350280860, 1350280920, 1350280980, 1350281040, 1350281700), tzone =
"", tclass = c("chron",
"dates", "times")), .Dim = c(366L, 1L), .Dimnames =
list(NULL,
"Close"))
-----------------------------------------------------------------------------
-----Original Message-----
From: "arun"<smartpink111>@yahoo.com>
To: "박상규"<birdfire94>@naver.com>;
Cc:
Sent: 2012-12-20 (목) 00:00:24
Subject: Re: [R] How to convert xts data into list
HI,
I don't know how the structure of your xts data looks like. I was assuming
that this was the way you created the xts object.
If you dput() the data, I would be happy to check it. BTW, are you saying that
the example dataset that I provided did not work? It worked for me.
A.K.
________________________________
From: 박상규 <birdfire94>@naver.com>
To: arun <smartpink111>@yahoo.com>
Sent: Wednesday, December 19, 2012 8:31 AM
Subject: Re: [R] How to convert xts data into list
Hi,
Thanks for reply. But I still failed to plot it.
I also found another way to plot it.
I converted xts data frame into matrix, and again matrix into list referencing
the following link.
http://www.statmethods.net/management/typeconversion.html
mat <- as.matrix(zc)
vec <- as.vector(mat)
plot(vec)
SK Park
-----Original Message-----
From: "arun"<smartpink111>@yahoo.com>
To: "박상규"<birdfire94>@naver.com>;
Cc: "R help"<r-help>@r-project.org>;
Sent: 2012-12-19 (수) 22:07:46
Subject: Re: [R] How to convert xts data into list
Hi,
I didn't understand ">".
Lines1<-textConnection("Date Time Close
10/15/12 09:00:00 252.40
10/15/12 09:01:00 253.10
10/15/12 09:02:00 253.15
10/15/12 09:03:00 253.30
10/15/12 09:04:00 253.25
10/15/12 09:05:00 253.45")
library(zoo)
library(xts)
z<- read.zoo(Lines1,header=TRUE,index=list(1,2),FUN=function(d,t)
as.chron(paste(as.Date(chron(d)),t)))
zc<-as.xts(z)
colnames(zc)<-"Close"
zc
# Close
#(10/15/12 09:00:00) 252.40
#(10/15/12 09:01:00) 253.10
#(10/15/12 09:02:00) 253.15
#(10/15/12 09:03:00) 253.30
#(10/15/12 09:04:00) 253.25
#(10/15/12 09:05:00) 253.45
length(as.list(zc$Close))
#[1] 1
1:length(zc$Close)
#[1] 1 2 3 4 5 6
plot(z) #works
plot(1:length(zc$Close),split(zc$Close,row(zc))) #should also work
A.K.
----- Original Message -----
From: 박상규 <birdfire94>@naver.com>
To: r-help@r-project.org
Cc:
Sent: Wednesday, December 19, 2012 2:45 AM
Subject: [R] How to convert xts data into list
Hello,
How can I convert Close colume of the below xts time series data into a list of
Close values ?
I'd like to plot Close values as a list.
> head(zc)
Close
(10/15/12 09:00:00) 252.40
(10/15/12 09:01:00) 253.10
(10/15/12 09:02:00) 253.15
(10/15/12 09:03:00) 253.30
(10/15/12 09:04:00) 253.25
(10/15/12 09:05:00) 253.45
I tried the below command to plot it. But it failed.
> plot(1:length(zc$Close),as.list(zc$Close))
Thanks in advance,
SK Park
[[alternative HTML version deleted]]
______________________________________________
R-help@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.
[[alternative HTML version deleted]]
Possibly Parallel Threads
- How to draw frequency domain plot with xts time series data
- 2.0.3-pre2: Spurious UPS UPS@localhost battery is low ?
- Question about error of "non-numeric argument to binary operator"
- Removing rows with rowsums==0 (I can't figure this out)
- Tukey post hoc comparison (glht?) after 3factorial mixed model (lmer)