如何在R中生成时间序列数据

R2D*_*2D2 2 analytics r time-series

我想使用R生成48小时,在csv文件中每50毫秒生成一次时间序列数据.

我尝试了以下内容,没有成功

x<-Sys.time()
x
# [1] "2015-12-05 08:00:29 EST"
x.ts <- ts(x, start=1, freq=2)
x.ts
# Time Series:
# Start = c(1, 1) 
# End = c(10, 1) 
# Frequency = 2 
# [1] 1449317249 1449317249 1449317249 1449317249 1449317249 1449317249
# [7] 1449317249 1449317249 1449317249 1449317249 1449317249 1449317249
# [13] 1449317249 1449317249 1449317249 1449317249 1449317249 1449317249
# [19] 1449317249
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏.

Soh*_*eil 5

你可以试试这个:

start <- as.POSIXct("2015-12-05 08:00:29.000", "%Y-%m-%d %H:%M:%OS")
end   <- as.POSIXct("2015-12-07 08:00:29.000", "%Y-%m-%d %H:%M:%OS")

x <- seq(start, end, by=0.05)
Run Code Online (Sandbox Code Playgroud)