Hello Let's say some questions about merging xts variables :
a<- xts("abc", Sys.Date()) b <- xts("def", Sys.Date()) c <- xts(1, Sys.Date()) > merge(a,b) a b 2015-09-03 "abc" "def" > merge(a,b,c) a b c 2015-09-03 NA NA 1 Warning messages: 1: In merge.xts(a, b, c) : NAs introduced by coercion 2: In merge.xts(a, b, c) : NAs introduced by coercion 3: In merge.xts(a, b, c) : NAs introduced by coercion 4: In merge.xts(a, b, c) : NAs introduced by coercion How I can merge a, b ,c correctly ? Another example is with Binary variables : > e<- xts(TRUE, Sys.Date()) > e [,1] 2015-09-03 TRUE > merge(e,b) e b 2015-09-03 1 NA Warning message: In merge.xts(e, b) : NAs introduced by coercion My second question is how I can convert an xts object to factor : > d <- merge(a,b) > d a b 2015-09-03 "abc" "def" > factor(d, levels = c("abc","def")) a b abc def Levels: abc def Date disappears here? Thanks for your help ce ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.