[R] removing dates from xts object..
akshay kulkarni
@k@h@y_e4 @end|ng |rom hotm@||@com
Mon Jul 25 22:20:24 CEST 2022
Dear members,
I have:
> head(testOHLC)
HINDUNILVR.NS.Open HINDUNILVR.NS.High HINDUNILVR.NS.Low HINDUNILVR.NS.Close
2007-01-02 217.80 219.00 215.45 216.40
2007-01-03 217.00 217.65 211.05 212.00
2007-01-04 213.00 214.25 209.65 210.60
2007-01-05 211.40 214.25 209.55 213.35
2007-01-08 213.35 213.35 207.10 210.10
2007-01-09 210.10 214.20 208.70 209.85
HINDUNILVR.NS.Volume HINDUNILVR.NS.Adjusted
2007-01-02 2626898 155.0396
2007-01-03 4603921 151.8872
2007-01-04 5486460 150.8841
2007-01-05 5706066 152.8545
2007-01-08 3760443 150.5260
2007-01-09 5474633 150.3468
AND:
> head(testOHLC["2007-01-09"])
HINDUNILVR.NS.Open HINDUNILVR.NS.High HINDUNILVR.NS.Low HINDUNILVR.NS.Close
2007-01-09 210.1 214.2 208.7 209.85
HINDUNILVR.NS.Volume HINDUNILVR.NS.Adjusted
2007-01-09 5474633 150.3468
BUT:
> head(testOHLC[-"2007-01-09"])
Error in -"2007-01-09" : invalid argument to unary operator
How do remove rows with certain dates in an xts object? This doesn't work:
x[-dates] (however, this does: x[dates])
Many thanks in advance......
Yours sincreley
AKSHAY M KULKARNI
[[alternative HTML version deleted]]
More information about the R-help
mailing list