How can I split hourly time series? I'm newbie in R and time series analysis. I'm trying to build an Arima model.
My dataset has this structure:
DATA         Ora    VALORE
&lt;chr&gt;       &lt;dbl&gt;    &lt;dbl&gt;
      
2018-09-01    1      3646742    
2018-09-01    2      3273110    
2018-09-01    3      3069245    
2018-09-01    4      2969621    

I've converted this dataset in a hourly time series and split it in a training set  and a test set with this code:
y &lt;- ts(data$VALORE,start=c(2018,09, 00:00), frequency=24*365)

y_train &lt;- window(y, c(2018, 09), c(2020, 06))

y_test &lt;- window(y,c(2020, 07), c(2020, 08))

Problems:

test set contains two observations (instead 1488 = all July and all August 2020);

training set contains 17518 observations (instead 16032).


Can I solve these problems?
The Solution that I have found:
y &lt;- ts(data$VALORE,
               frequency = 24,   
               start = 1)        

train &lt;- ts(y[1:12264], frequency=24) #70%
val &lt;- ts(y[12265:17520], frequency=24) #30%