[R-SIG-Finance] Delete bad dividend row
G See
gsee000 at gmail.com
Mon Jul 1 00:14:50 CEST 2013
Hi Frank,
There are a few ways to do it.
library(quantmod)
div <- getDividends("PM", from="2010-01-01")
# find the row(s) you want to remove and use negative indexing
div[-12]
div[-which(div == 0.039)]
div[-div["2012-12-20", which.i=TRUE]]
# exclude specific date by passing logical vector to [.xts
div[!index(div) %in% as.Date("2012-12-20")]
# exclude specific weekdays
div[weekdays(index(div)) != "Thursday"]
div[as.POSIXlt(index(div))$wday != 4]
# exclude amounts smaller than some arbitrary number
div[div > 0.1]
# exclude specific amount
div[div != 0.039]
HTH,
Garrett
More information about the R-SIG-Finance
mailing list