-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[R-Forge #1602] Can't merge multiple objects with character values #44
Comments
The n-way merge case currently only works for logical, integer, and numeric types. Character, complex, and any other type will fail. It should be possible to add support for character and complex data. |
Wanted to note this also effects library(xts)
set.seed(1234)
dat = xts(data.frame(char = rep(c("A","B"),5)), order.by =as.POSIXct(paste0("1992-01-",1:10)) )
xLagDiff = lapply(1:5,function(i) {
lags = lag.xts(dat,k = i)
colnames(lags) = paste0(colnames(lags),i)
lags
})
xLagDiff2 = do.call(cbind.zoo,xLagDiff)
xLagDiff2
|
@SteveBronder, your example doesn't run. |
@joshuaulrich apologies, amended the example |
@SteveBronder awesome, thanks! Note that this only affects R> lag(dat,2:3)
char char.1
1992-01-01 NA NA
1992-01-02 NA NA
1992-01-03 "A" NA
1992-01-04 "B" "A"
1992-01-05 "A" "B"
1992-01-06 "B" "A"
1992-01-07 "A" "B"
1992-01-08 "B" "A"
1992-01-09 "A" "B"
1992-01-10 "B" "A" |
Yeesh, just looked at the R-Forge issue tracker and saw:
I hope "better late than never" applies... Sorry about the massive delay, @kenahoo. |
Submitted by: Ken Williams (@kenahoo)
Assigned to: Nobody
R-Forge link
It appears that the merge() function fails when fed more than 2 xts objects, and they contains character data:
By contrast, it works fine when the data is numeric:
Perhaps something's being silently converted to a factor internally?
-Ken
The text was updated successfully, but these errors were encountered: