Perfect, works like a charm. Thanks Gabor. Sean. On Mon, Nov 10, 2008 at 11:35 PM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > On Mon, Nov 10, 2008 at 12:31 AM, Sean Carmody <[EMAIL PROTECTED]> wrote: >> The tricks for removing columns specified by name from data frames such as >> >> x$mycol <- NULL > > That only works for data frames since they are based on > lists but not for objects like matrix, ts and zoo which are not > based on lists. Try this: > > library(zoo) > z <- zoo(cbind(a = 1:2, b = 3:4, c = 5:6)) > # all but b > z <- z[, colnames(z) != "b"] > z > > z <- zoo(cbind(a = 1:2, b = 3:4, c = 5:6)) > # all but b and c > z <- z[, ! colnames(z) %in% c("b", "c")] > z >
-- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.