Skip to content

Column Name Matching in xts Objects

2 messages · Pooya Lalehzari, Joshua Ulrich

#
On Thu, Nov 14, 2013 at 12:06 PM, Pooya Lalehzari
<plalehzari at platinumlp.com> wrote:
xts doesn't have a $<- method, so $<-.zoo is dispatched.  I'm not
familiar with the function, but the behavior you found is explicitly
defined, so that seems to suggest it was intended.
wi <- match(x, colnames(object))
  if(is.na(wi)) {
    object <- cbind(object, value)
    if(is.null(dim(object))) dim(object) <- c(length(object), 1)
    colnames(object)[NCOL(object)] <- x
  } else {
    ...

Best,
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com