<<insert bug report here>>> apply(array(1:20,c(2,2,5)),2:3,function(x) x)Error: length of dimnames must match that of dims>Changing: dimnames = if (is.null(dn.ans)) list(ans.names, NULL) else c(list(ans.names), dn.ans) To: dimnames = if (length(dn)==0) NULL else if (is.null(dn.ans)) list(ans.names, NULL) else c(list(ans.names), dn.ans) seems to fix this. Chuck Berry --please do not edit the information below-- Version: platform = sparc-sun-solaris2.7 arch = sparc os = solaris2.7 system = sparc, solaris2.7 status = Release major = 0 minor = 65.1 year = 1999 month = October day = 07 language = R Search Path: .GlobalEnv, Autoloads, package:base -- Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry@tajo.ucsd.edu UC San Diego http://hacuna.ucsd.edu/members/ccb.html La Jolla, San Diego 92093-0645 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thanks a lot, Chuck!>>>>> "ChuckB" == Charles C Berry <cberry@tajo.ucsd.edu> writes:>> apply(array(1:20,c(2,2,5)),2:3,function(x) x) ChuckB> Error: length of dimnames must match that of dims ChuckB> Changing: ChuckB> dimnames = if (is.null(dn.ans)) list(ans.names, NULL) else c(list(ans.names), dn.ans) ChuckB> To: ChuckB> dimnames = if (length(dn)==0) NULL else ChuckB> if (is.null(dn.ans)) list(ans.names, NULL) else c(list(ans.names), dn.ans) ChuckB> seems to fix this. yes. I've committed the patch as follows (starting at line 59 in src/library/base/R/apply.R) : if(len.a > 0 && len.a %% d2 == 0) return(array(ans, c(len.a %/% d2, d.ans), - dimnames = if(is.null(dn.ans)) list(ans.names,NULL) - else c(list(ans.names), dn.ans))) + dimnames = if(length(dn)) { + if(is.null(dn.ans)) list(ans.names,NULL) + else c(list(ans.names), dn.ans)})) return(ans) Thanks again! Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <>< -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> "MM" == Martin Maechler <maechler@stat.math.ethz.ch> writes:MM> Thanks a lot, Chuck!>>>>> "ChuckB" == Charles C Berry <cberry@tajo.ucsd.edu> writes:>>> apply(array(1:20,c(2,2,5)),2:3,function(x) x) ChuckB> Error: length of dimnames must match that of dims ChuckB> Changing: ChuckB> dimnames = if (is.null(dn.ans)) list(ans.names, NULL) else c(list(ans.names), dn.ans) ChuckB> To: ChuckB> dimnames = if (length(dn)==0) NULL else ChuckB> if (is.null(dn.ans)) list(ans.names, NULL) else c(list(ans.names), dn.ans) ChuckB> seems to fix this. MM> yes. MM> I've committed the patch as follows MM> (starting at line 59 in src/library/base/R/apply.R) : MM> if(len.a > 0 && len.a %% d2 == 0) MM> return(array(ans, c(len.a %/% d2, d.ans), MM> - dimnames = if(is.null(dn.ans)) list(ans.names,NULL) MM> - else c(list(ans.names), dn.ans))) MM> + dimnames = if(length(dn)) { MM> + if(is.null(dn.ans)) list(ans.names,NULL) MM> + else c(list(ans.names), dn.ans)})) MM> return(ans) which is unfortunately wrong (thank, PD!). A more correct patch has src/library/base/R/apply.R ending with if(len.a > 0 && len.a %% d2 == 0) return(array(ans, c(len.a %/% d2, d.ans), if(is.null(dn.ans)) { if(!is.null(ans.names)) list(ans.names,NULL) } else c(list(ans.names), dn.ans))) return(ans) } MM -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._