Home > Mobile >  subsetting data by date in R
subsetting data by date in R

Time:12-28

._883<-quantmod::getSymbols("0883.HK",from="2022-04-21",to="2022-12-28",auto.assign = FALSE)

the data set covers from 2022-04-21 to 12-28, now I am trying to subset or divide the data in 2 ways, one is to cut off the data by actual date and the other one is by a ratio, say 80/20, may I know how should I subset the data in R? Thanks a lot.

CodePudding user response:

Another solution could be:

library(rsample)
split <- initial_split(._883, prop = .8)

training(split) 
testing(split) 
  • Related