How to define date column and plot that date column as x axis in R studio

I have half-hourly time series data; 48 data points in a day. The total time period starts from 4/6/2018 (i.e day/month/year) to 2/12/2018. I want to create a time series object. I am using ts function.

However, I am unable to define the frequency. As I know, frequency=1 for yearly data, but unable to define in my half-hourly data. How to solve this problem using ts object or there is any other way to do it?

After creating a time series object (i.e. date column), I want to plot it with the corresponding data series.

How to plot my result (in R object) on Y-axis and time period on the X-axis?

R <- function(x){
return(FDWhittle(x, method="discrete", sdf.method="multitaper"))
}
plot(R[,i],type="l",col = "Black", xlab="Time",
   ylab="Return",main=names(R)[,i])

When I am plotting by using the above code, the results in the object "R" is coming on the Y-axis, and some values like (100, 200, 300--------) are coming on the X-axis. I want to get the time period on my X axis, but unable to define the intra-day date column having 48 data points in a day.

I have posted the same query in stackoverflow. But, didn't get any reply. I am attaching the link of StackOverflow where I posted my queries.

Therefore, without having any idea, I posted it here. Please help me.

Thanks.

I have half-hourly time series data; 48 data points in a day. The total time period starts from 4/6/2018 (i.e day/month/year) to 2/12/2018. I want to create a time series object. I am using ts function.

However, I am unable to define the frequency. As I know, frequency=1 for yearly data, but unable to define in my half-hourly data. How to solve this problem using ts object or there is any other way to do it?

After creating a time series object (i.e. date column), I want to plot it with the corresponding data series.

How to plot my result (in R object) on Y-axis and time period on the X-axis?

R <- function(x){
return(FDWhittle(x, method="discrete", sdf.method="multitaper"))
}
plot(R[,i],type="l",col = "Black", xlab="Time",
   ylab="Return",main=names(R)[,i])

When I am plotting by using the above code, the results in the object "R" is coming on the Y-axis, and some values like (100, 200, 300--------) are coming on the X-axis. I want to get the time period on my X axis, but unable to define the intra-day date column having 48 data points in a day.

What does the structure of your data set look like? Can you provide sample data?

The data structure is 30 min. intervals. In particular, Each day will be having 42 data points. I am unable to attach my data file here, so pasted the part of my sample data. Total, I have 6 months data with total 8677 observations having 42 data points in each day. Here, I want to do rolling window of 30 so that the total resulted observation will be (8677-30)+1= 8648. I want to plot such rolling results with the result in the Y-axis and date column in the X-axis. Please suggest me.

Date X
03-06-2018 17:00 7709.99
03-06-2018 17:30 7690.01
03-06-2018 18:00 7694.01
03-06-2018 18:30 7704.59
03-06-2018 19:00 7710
03-06-2018 19:30 7706.37
03-06-2018 20:00 7720
03-06-2018 20:30 7709.89
03-06-2018 21:00 7706.8
03-06-2018 21:30 7705
03-06-2018 22:00 7689.82
03-06-2018 22:30 7685.54
04-06-2018 00:30 7696.21
04-06-2018 01:00 7696.19
04-06-2018 01:30 7661.63
04-06-2018 02:00 7650.02
04-06-2018 02:30 7582.51
04-06-2018 03:00 7612.23
04-06-2018 03:30 7599.61
04-06-2018 04:00 7588.31
04-06-2018 04:30 7599.54
04-06-2018 05:00 7584.54
04-06-2018 05:30 7612.52
04-06-2018 06:00 7611
04-06-2018 06:30 7595.01
04-06-2018 07:00 7535.01
04-06-2018 07:30 7506.1
04-06-2018 08:00 7523
04-06-2018 08:30 7529.86
04-06-2018 09:00 7521.14
04-06-2018 09:30 7505
04-06-2018 10:00 7479.11
--- ---
04-06-2018 10:30 7481
04-06-2018 11:00 7499.5
04-06-2018 11:30 7496.17
04-06-2018 12:00 7494.9
04-06-2018 12:30 7485
04-06-2018 13:00 7456.92
04-06-2018 13:30 7479.03
04-06-2018 14:00 7477.87
04-06-2018 14:30 7499.89
04-06-2018 15:00 7506.85
04-06-2018 15:30 7493.56
04-06-2018 16:00 7491.48
04-06-2018 16:30 7525.44
04-06-2018 17:00 7534.3
04-06-2018 17:30 7525.04
04-06-2018 18:00 7505.01
04-06-2018 18:30 7499.02
04-06-2018 19:00 7481
04-06-2018 19:30 7487.41
04-06-2018 20:00 7493.99
04-06-2018 20:30 7487.22
04-06-2018 21:00 7490
04-06-2018 21:30 7482.85
04-06-2018 22:00 7421.71
04-06-2018 22:30 7404.04
04-06-2018 23:00 7414
04-06-2018 23:30 7407.91
05-06-2018 00:00 7409.02
05-06-2018 00:30 7387.73
05-06-2018 01:00 7417.98
05-06-2018 01:30 7428.99
05-06-2018 02:00 7427.89
05-06-2018 02:30 7426.95
05-06-2018 03:00 7407.35
05-06-2018 03:30 7408.47
05-06-2018 04:00 7437.46
05-06-2018 04:30 7450.01
05-06-2018 05:00 7430.8
05-06-2018 05:30 7420.01
05-06-2018 06:00 7430.84
05-06-2018 06:30 7419.99
05-06-2018 07:00 7430.29
05-06-2018 07:30 7417.98
05-06-2018 08:00 7418.72
05-06-2018 08:30 7406.59
05-06-2018 09:00 7419.99
05-06-2018 09:30 7381.62
05-06-2018 10:00 7409.12
05-06-2018 10:30 7404.97
05-06-2018 11:00 7461.74
05-06-2018 11:30 7575.79
05-06-2018 12:00 7547.21
05-06-2018 12:30 7567
05-06-2018 13:00 7590.02
05-06-2018 13:30 7615.05
05-06-2018 14:00 7621
05-06-2018 14:30 7617.43
05-06-2018 15:00 7622.65
05-06-2018 15:30 7610.19
05-06-2018 16:00 7614.01
05-06-2018 16:30 7624.44
05-06-2018 17:00 7594.03
05-06-2018 17:30 7585.89
05-06-2018 18:00 7600.01
05-06-2018 18:30 7624
05-06-2018 19:00 7603.91
05-06-2018 19:30 7612.51
05-06-2018 20:00 7615.51
05-06-2018 20:30 7606.05
05-06-2018 21:00 7619
05-06-2018 21:30 7627.99
05-06-2018 22:00 7607.4
05-06-2018 22:30 7613.52
05-06-2018 23:00 7613.17
05-06-2018 23:30 7609.36
06-06-2018 00:00 7590.87
06-06-2018 00:30 7587.39
06-06-2018 01:00 7588.33
06-06-2018 01:30 7599
06-06-2018 02:00 7633.57
06-06-2018 02:30 7625.64
06-06-2018 03:00 7619.49
06-06-2018 03:30 7612.57
06-06-2018 04:00 7603.09
06-06-2018 04:30 7611.31
06-06-2018 05:00 7602.98
06-06-2018 05:30 7594.01
06-06-2018 06:00 7599.92
06-06-2018 06:30 7606.9
06-06-2018 07:00 7619.98
06-06-2018 07:30 7615.38
06-06-2018 08:00 7605.77
06-06-2018 08:30 7653.1
06-06-2018 09:00 7638
06-06-2018 09:30 7635
06-06-2018 10:00 7629.01
06-06-2018 10:30 7620.84
06-06-2018 11:00 7630.79
06-06-2018 11:30 7655
06-06-2018 12:00 7565.46
06-06-2018 12:30 7515.16
06-06-2018 13:00 7520
06-06-2018 13:30 7525.1
06-06-2018 14:00 7492.35
06-06-2018 14:30 7509.38
06-06-2018 15:00 7518
06-06-2018 15:30 7529.96
06-06-2018 16:00 7515.94
06-06-2018 16:30 7619.34
06-06-2018 17:00 7685.63
06-06-2018 17:30 7654.76
06-06-2018 18:00 7653.02
06-06-2018 18:30 7656.94
06-06-2018 19:00 7654.98
06-06-2018 19:30 7655
06-06-2018 20:00 7669.68
06-06-2018 20:30 7716.47
06-06-2018 21:00 7733.49
06-06-2018 21:30 7716.79
06-06-2018 22:00 7720.01
06-06-2018 22:30 7708.01
06-06-2018 23:00 7725.92
06-06-2018 23:30 7727
07-06-2018 00:00 7709.05
07-06-2018 00:30 7714.41
07-06-2018 01:00 7711.3
07-06-2018 01:30 7704
07-06-2018 02:00 7689.34
07-06-2018 02:30 7699.68
07-06-2018 03:00 7700.99
07-06-2018 03:30 7705
07-06-2018 04:00 7698.42
07-06-2018 04:30 7683.97
07-06-2018 05:00 7681.6
07-06-2018 05:30 7697.57
07-06-2018 06:00 7694.78
07-06-2018 06:30 7680.24
07-06-2018 07:00 7694.9
07-06-2018 07:30 7680.34
07-06-2018 08:00 7689.99
07-06-2018 08:30 7692.37
07-06-2018 09:00 7707.49
07-06-2018 09:30 7694.78
07-06-2018 10:00 7671.24
07-06-2018 10:30 7676.55
07-06-2018 11:00 7663.79
07-06-2018 11:30 7683.85
07-06-2018 12:00 7683.04
07-06-2018 12:30 7705
07-06-2018 13:00 7689.99
07-06-2018 13:30 7695.02
07-06-2018 14:00 7699.36
07-06-2018 14:30 7695.01
07-06-2018 15:00 7684.73
07-06-2018 15:30 7690
07-06-2018 16:00 7666.02
07-06-2018 16:30 7660
07-06-2018 17:00 7663.48
07-06-2018 17:30 7657.27
07-06-2018 18:00 7658
07-06-2018 18:30 7656.58
07-06-2018 19:00 7660
07-06-2018 19:30 7684.93
07-06-2018 20:00 7680
07-06-2018 20:30 7684.01
07-06-2018 21:00 7683.6
07-06-2018 21:30 7671.5
07-06-2018 22:00 7676.54
07-06-2018 22:30 7656.98
07-06-2018 23:00 7653.46
07-06-2018 23:30 7639.03
08-06-2018 00:00 7645.73
08-06-2018 00:30 7633.51
08-06-2018 01:00 7631.01
08-06-2018 01:30 7634.83
08-06-2018 02:00 7631.99
08-06-2018 02:30 7644.12
08-06-2018 03:00 7649
08-06-2018 03:30 7629.89
08-06-2018 04:00 7617.87
08-06-2018 04:30 7636.27
08-06-2018 05:00 7634.96
08-06-2018 05:30 7630.6
08-06-2018 06:00 7585
08-06-2018 06:30 7570.37
08-06-2018 07:00 7561.94
08-06-2018 07:30 7560.01
08-06-2018 08:00 7547.1
08-06-2018 08:30 7551.67
08-06-2018 09:00 7574.5
08-06-2018 09:30 7582.97
08-06-2018 10:00 7575.59
08-06-2018 10:30 7588.01
08-06-2018 11:00 7581.06
08-06-2018 11:30 7635.97
08-06-2018 12:00 7644.99
08-06-2018 12:30 7652.23
08-06-2018 13:00 7650.01
08-06-2018 13:30 7650
08-06-2018 14:00 7644.5
08-06-2018 14:30 7644.49
08-06-2018 15:00 7640
08-06-2018 15:30 7637.85
08-06-2018 16:00 7649.35
08-06-2018 16:30 7646.82
08-06-2018 17:00 7639.99
08-06-2018 17:30 7649.36
08-06-2018 18:00 7649.99
08-06-2018 18:30 7637.1
08-06-2018 19:00 7630
08-06-2018 19:30 7618.8
08-06-2018 20:00 7625
08-06-2018 20:30 7628.47
08-06-2018 21:00 7635.02
08-06-2018 21:30 7650
08-06-2018 22:00 7671.62
08-06-2018 22:30 7671.77
08-06-2018 23:00 7660.5
08-06-2018 23:30 7659.8
09-06-2018 00:00 7667.02
09-06-2018 00:30 7660.8
09-06-2018 01:00 7652.82
09-06-2018 01:30 7660.89
09-06-2018 02:00 7668.41
09-06-2018 02:30 7662.51
09-06-2018 03:00 7660.01
09-06-2018 03:30 7651.42
09-06-2018 04:00 7646.23
09-06-2018 04:30 7625.01
09-06-2018 05:00 7635.65
09-06-2018 05:30 7638.64
09-06-2018 06:00 7648.87
09-06-2018 06:30 7650.01
09-06-2018 07:00 7638.9
09-06-2018 07:30 7630.66
09-06-2018 08:00 7632.51
09-06-2018 08:30 7604.99
09-06-2018 09:00 7599.55
09-06-2018 09:30 7593.56
09-06-2018 10:00 7600
09-06-2018 10:30 7595.01
09-06-2018 11:00 7615.26
09-06-2018 11:30 7619.69
09-06-2018 12:00 7605.01
09-06-2018 12:30 7579.11
09-06-2018 13:00 7582.38
09-06-2018 13:30 7599
09-06-2018 14:00 7593
09-06-2018 14:30 7610.11
09-06-2018 15:00 7610.99
09-06-2018 15:30 7611.96
09-06-2018 16:00 7620
09-06-2018 16:30 7627.5
09-06-2018 17:00 7615.14
09-06-2018 17:30 7617.04
09-06-2018 18:00 7602.55
09-06-2018 18:30 7597.99
09-06-2018 19:00 7607.02
09-06-2018 19:30 7496.4
09-06-2018 20:00 7371.33
09-06-2018 20:30 7280.07
09-06-2018 21:00 7311.11
09-06-2018 21:30 7327
09-06-2018 22:00 7313.01
09-06-2018 22:30 7327.34
09-06-2018 23:00 7293.06
09-06-2018 23:30 7272.38
10-06-2018 00:00 7316.11
10-06-2018 00:30 7290
10-06-2018 01:00 7304.16
10-06-2018 01:30 7305.38
10-06-2018 02:00 7316.01
10-06-2018 02:30 7319.81
10-06-2018 03:00 7294.79
10-06-2018 03:30 7209.39
10-06-2018 04:00 7198.85
10-06-2018 04:30 7222.01
10-06-2018 05:00 7251.99
10-06-2018 05:30 7243.14
10-06-2018 06:00 7223.08
10-06-2018 06:30 7247.58
10-06-2018 07:00 7251.92
10-06-2018 07:30 7234.99
10-06-2018 08:00 7257.13
10-06-2018 08:30 7237.81
10-06-2018 09:00 7247.14
10-06-2018 09:30 7279.11
10-06-2018 10:00 7262.09
10-06-2018 10:30 7240.01
10-06-2018 11:00 7232.49
10-06-2018 11:30 7236.99
10-06-2018 12:00 7209.09
10-06-2018 12:30 7208
10-06-2018 13:00 7084.04
10-06-2018 13:30 6751.96
10-06-2018 14:00 6739.8
10-06-2018 14:30 6759.02
10-06-2018 15:00 6769.01
10-06-2018 15:30 6868
10-06-2018 16:00 6800.01
10-06-2018 16:30 6738.58
10-06-2018 17:00 6718
10-06-2018 17:30 6758.78
10-06-2018 18:00 6709.94
10-06-2018 18:30 6687.99
10-06-2018 19:00 6727.46
10-06-2018 19:30 6770.31
10-06-2018 20:00 6750
10-06-2018 20:30 6730.39
10-06-2018 21:00 6734.63
10-06-2018 21:30 6763.43
10-06-2018 22:00 6810.01
10-06-2018 22:30 6795.79
10-06-2018 23:00 6774.85
10-06-2018 23:30 6785.37
11-06-2018 00:00 6789.23
11-06-2018 00:30 6802.05
11-06-2018 01:00 6774.31
11-06-2018 01:30 6755.01
11-06-2018 02:00 6773.84
11-06-2018 02:30 6770.41
11-06-2018 03:00 6774.88
11-06-2018 03:30 6667.88
11-06-2018 04:00 6775.39
11-06-2018 04:30 6796.57
11-06-2018 05:00 6787.96
11-06-2018 05:30 6772.8
11-06-2018 06:00 6753.97
11-06-2018 06:30 6773.74
11-06-2018 07:00 6783.37
11-06-2018 07:30 6788.79
11-06-2018 08:00 6758.18
11-06-2018 08:30 6764.69
11-06-2018 09:00 6762.93
11-06-2018 09:30 6753.52
11-06-2018 10:00 6715
11-06-2018 10:30 6720
11-06-2018 11:00 6692.45
11-06-2018 11:30 6714.99
11-06-2018 12:00 6741.31
11-06-2018 12:30 6738.01
11-06-2018 13:00 6739.98
11-06-2018 13:30 6719
11-06-2018 14:00 6709.24
11-06-2018 14:30 6755
11-06-2018 15:00 6756.3
11-06-2018 15:30 6765.01
11-06-2018 16:00 6749.28
11-06-2018 16:30 6765.72
11-06-2018 17:00 6774
11-06-2018 17:30 6773.99
11-06-2018 18:00 6770.14
11-06-2018 18:30 6789.98
11-06-2018 19:00 6798.3
11-06-2018 19:30 6881.78
11-06-2018 20:00 6844
11-06-2018 20:30 6849
11-06-2018 21:00 6851.1

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.