Hello, I found a potential problem in R 2.1.0 (and R 2.0.1) I expect that
> tmp <- FUN(x1, x2, x3, x4) > as.data.frame(tmp) is the same as > as.data.frame(FUN(x1, x2, x3, x4)) since the tmp variable in this case is unnecessary. However, below I will demonstrate that under an odd set of conditions, I can correctly perform as.data.frame(tmp), but not as.data.frame(FUN(x1, x2, x3, x4)). ## This code works correctly FUN <- function(x1, x2, x3, x4) cbind(x1[, 1, 1:2], x1[, 2, 1:2])[, 1] x1 <- array(1:9, c(3, 3, 3)) tmp <- FUN(x1[1:3, , ], x2 = c("a", "b"), x3 = c("a", "b"), x4 = c("a", "b")) ## Works correctly as.data.frame(tmp) tmp 1 1 2 2 3 3 ## This (supposedly equivalent) code gives an error as.data.frame(FUN(x1[1:3,,], x2 = c("a", "b"), x3 = c("a", "b"), x4 = c("a", "b"))) Error in "names<-.default"(`*tmp*`, value = c("FUN(x1[1:3, , ], x2 = c(\"a\", \"b\"), x3 = c(\"a\", \"b\"), x4 = c(\"a\", ", : 'names' attribute [2] must be the same length as the vector [1] Note, that while the extra (unused) arguments in FUN seem unnecessary, as well as the odd indexing, the problem disappears when I remove the extraneous values. Unfortunately, I have not found a more elegant way to present this problem, but hopefully this code will be helpful. Robert Robert McGehee Geode Capital Management, LLC 53 State Street, 5th Floor | Boston, MA | 02109 Tel: 617/392-8396 Fax:617/476-6389 mailto:[EMAIL PROTECTED] This e-mail, and any attachments hereto, are intended for us...{{dropped}} ______________________________________________ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel