[R] Time on x-axis

Sangeetha Swaminathan sangi at itc.utk.edu
Fri Feb 24 21:49:01 CET 2006


Hello,

   Thank you! It worked!! Now I have another query; I have about 300 data 
entries, and I dont think it would be possible to quote everything under 
tt<-c("") or x<-c(). Is there any way to plot the graph, without having to 
manually quote all the data items in the array?

Thank you.

Sangeetha

>===== Original Message From "Gabor Grothendieck" <ggrothendieck at gmail.com> 
=====
>Try this:
>
># test data
>tt <- c("23:05:02", "23:10:02", "23:15:03", "23:20:03", "23:25:03",
>"23:30:03", "23:35:03", "23:40:03", "23:45:04", "23:50:04", "23:55:03",
>"23:55:03")
>x <- c(0.575764, 0.738379, 0.567414, 0.663436, 0.599834, 0.679571,
>0.88141, 0.868848, 0.969271, 0.878968, 0.990972, 0.990972)
>
>library(zoo)
>library(chron)
>z <- zoo(x, times(tt))
>plot(z)
>
>Read the R Help Desk article in R News 4/1 about dates and times
>and also read the chron article in its references.
>
>Also read the zoo vignette which you can access like this:
>
>library(zoo)
>vignette("zoo")
>
>and also read ?axis in case you want to customize the axes.
>
>
>On 2/20/06, Sangeetha Swaminathan <sangi at itc.utk.edu> wrote:
>> Hello,
>>
>>   I just started using the GNU R. I am having trouble plotting my data. I 
am
>> tryin to plot the following data:
>>
>> TIMESTAMP    LOGIN-TIME
>> (hh:mm:ss)          (s)
>>
>> 23:55:03       0.990972
>> 23:55:03       0.990972
>> 23:50:04       0.878968
>> 23:45:04       0.969271
>> 23:40:03       0.868848
>> 23:35:03        0.88141
>> 23:30:03       0.679571
>> 23:25:03       0.599834
>> 23:20:03       0.663436
>> 23:15:03       0.567414
>> 23:10:02       0.738379
>> 23:05:02       0.575764
>>
>> with TIMESTAMP on the x-axis. The plot() function assumes the x-axis as the
>> total number of events, and plots the desired graph. But I want the 
TIMESTAMP
>> on the x-axis. If I try to change the x-axis, the y-axis gets modified too,
>> and all I get is just a "dot" as a plot.
>> Can someone tell me how I can make R plot my graph, with TIMESTAMP as my
>> x-axis and LOGIN_TIME as my y-axis?
>>
>> Thank you.
>>
>> Sangeetha
>>
>> -- Sangeetha Swaminathan
>> Graduate Assistant
>> Innovative Technology Center (ITC)
>> 2444 Dunford Hall
>> The University of Tennessee
>> Knoxville, TN 37996
>> Phone [O]:(865) 974-9672
>>      [R]:(865) 946-4340
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
>>

-- Sangeetha Swaminathan
Graduate Assistant
Innovative Technology Center (ITC)
2444 Dunford Hall
The University of Tennessee
Knoxville, TN 37996
Phone [O]:(865) 974-9672
      [R]:(865) 946-4340




More information about the R-help mailing list