The R language cannot automatically convert the read data into a time series format,
So a key step in using R language to draw a time series diagram is to convert the data read into a time series format,
The following is a simple program:
# read data, first convert Excel format to CSV format and then read
h <-read.table (file = "D:/data/50etfx1.csv", Sep = ",", Header = T)
#
Convert the data format into the time series format
Library (XTS) # Load the required package
hh <-xts (h$x1, as. Date (H$time, format= '%y/%m/%d '))
# Draw
# Specify the length of the graph or draw directly with command Plot (HH)
win.graph (width = 9.5 , height = 4.5,pointsize = 8)
plot (Hh,type = ' l ', main= ')
The effect is as follows:
The data format used by the sample program is as follows:
Time X1
2013/2/5 on 0.000000
2013/2/6 on 0.007236
2013/2/7-0.011708
2013/2/8-0.004989
2013/2/18-0.010806
2013/2/19-0.015255
2013/2/20-0.001583
2013/2/21-0.040148
。。。。。。。。。。。。
2015/1/29-0.019893
2015/1/30-0.016171
2015/2/2-0.031637
2015/2/3 on 0.027171
2015/2/4-0.015722
2015/2/5-0.010018
2015/2/6-0.012613