On Sat, 8 Jan 2011, Pete B wrote:


Hi All

I am trying to find a way to prevent column names from changing on zoo
objects when I merge them.

I have column names that contain a "-" that after merging have become "."

# Example
zz1 = zoo(as.matrix(1:5))
zz2 = zoo(as.matrix(10:12))

names(zz1)=c("aa-1")
names(zz2)=c("bb-1")

zz3=merge(zz1,zz2)

merge(zz1, zz2, check.names = FALSE)

should do what you want.

(This is also the default in the devel version on R-Forge.)

hth,
Z

print(zz3)

Obviously, I could do something like

names(zz3) = c(names(zz1),names(zz2))

but I have a large number of zoo objects that I am merging. Creating the
simple line above is not that easy.

Any thoughts would be gratefully received.

Kind regards

Pete




--
View this message in context: 
http://r.789695.n4.nabble.com/zoo-column-names-tp3205568p3205568.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.


______________________________________________
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.

Reply via email to