时间资料要用正确的资料型态, 这里我用POSIXlt当范例
把这些资料储存成`data.txt`:
: 2008-04-07 17:33:48|1730.05
: 2008-04-08 12:28:13|1222.02
: 2008-04-09 12:26:23|1215.51
: 2008-04-11 12:41:00|1248.12
: 2008-04-12 14:01:15|1398.85
: 2008-04-14 12:37:15|1235.13
: 2008-04-15 12:24:22|1220.12
: 2008-04-15 17:33:48|1742.14
: 2008-04-16 12:23:52|1220.32
: 2008-04-17 12:35:46|1240.22
: [程式范例]:
```r
src.df <- read.table("data.txt", sep="|")
colnames(src.df) <- c("time", "value")
src.df$value <- as.numeric(src.df$value)
src.df$time <- strptime(src.df$time, "%Y-%m-%d %H:%M:%S")
src.df$sec <- unclass(src.df$time)$sec
src.df$min <- unclass(src.df$time)$min
src.df$hr <- unclass(src.df$time)$hour
src.df$dtime <- src.df$hr * 3600 + src.df$min * 60 + src.df$sec
plot(value ~ dtime, src.df)
```
这可能是你要的