hi all -- let's say i have the following simplified plyr code: > factor_table <- data.frame(dim1 = 1:10, dim2 = 1:4) > foo <- maply(factor_table, function(dim1, dim2) list(a = "foo", b = runif(10)))
foo will now be a 10 x 4 x 2 array (of mode 'list'), and i'll have to access a "b" element like so: > foo[[1,1,"b"]] if i replace the anonymous function with another that returns a variable-length list, however, foo will be a 10 x 4 array (again of mode 'list'), and i'll have to access a "b" element like so: > foo[[1,1]]$b ## or foo[[1,1]][["b"]] i tend to prefer this latter approach, since it's agnostic to the called function in the maply loop, and thus makes downstream coding more consistent (in case upstream functions change, the addressing scheme required to recover that function's various return values is somewhat uniform). does anyone know if we can "force" plyr to _not_ try to simplify along the inner function's return value length when using the _aply family of calls? cheers, -m [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list 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.