I am doing a multi-period analysis and I need to extract values between two dates from an xts object named data.
The start and end of my calculation lies between those dates. These same dates are used as rownames in a data.frame named results.
start_date <- head(rownames(results), n=1)
end_date <- tail(rownames(results), n=1)
I also identify the column names with this vector:
> col_names
[1] "Stock1" "Stock2" "Stock3"
I need to extract the observations in the data object in the columns in col_names and between start_date and end_date.