[R] zoo column names

Pete Brecknock Peter.Brecknock at bp.com
Fri May 27 01:35:12 CEST 2011


I have a zoo object that contains 2 time series named "A-B" and "V1".

When I create a third series "V2", the name of the "A-B" series is changed
to "A.B". 

Although I could recreate the names for the 3 series I am wondering if there
is a way of preventing the name change from happening  ( ... maybe an
equivalent of the keep.names=TRUE statement on merge.zoo)?


#------------------------------------------------
library(zoo)

# Create zoo data with required col names
d = data.frame(c(10,20,30),c(1,2,3))
names(d) = c("A-B", "V1")
d.z = zoo(d,1:3)

# Create new variable "V2"
# col name changes from "A-B" to "A.B"
d.z$V2 = d.z[,"V1"] *100

# recreate col names
names(d.z) = c(names(d),"V2")
#-------------------------------------------------

Thanks

Pete


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



More information about the R-help mailing list