[R] Time plot question.

Gabor Grothendieck ggrothendieck at myway.com
Wed Nov 12 06:12:13 CET 2003


Either of these should work:


tt = c( "01:03:30", "18:21:03", "22:29:56", "23:03:20" )
y <- 1:4

require(chron)
plot(chron(times=tt),y)

# or

plot(strptime(tt,format="%H:%M:%S"),y)

--- 
Date: Tue, 11 Nov 2003 20:36:57 -0800 
From: John <heimdal at aracnet.com>
To: <r-help at stat.math.ethz.ch> 
Subject: [R] Time plot question. 

 
 
Hello,

I have parsed out some data from a file containing output from the top 
command. The time stamps are of the form "hh:mm:ss". When the command 

plot( Time, FreeMemory, type = "l", col = "blue", main = "\"swap in use\" 
versus Time", xlab = "Time", ylab = "Swap in Use")

is executed, the plot() function ignores the col and type arguments and plots 
the points in some sort of default manner. Do I need to use strptime() and 
reformat the "Time" coordinates? Where could I find some documentation on 
this, as the R docs that I am aware of do not contain an example of this. Any 
suggestions on this will be greatly appreciated.

Cheers,

John

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list