Hello >From outer help page: outer takes two vectors <https://renenyffenegger.ch/notes/development/languages/R/data-structures/vector/index> and a function (that itself takes two arguments) and builds a matrix <https://renenyffenegger.ch/notes/development/languages/R/data-structures/matrix/index> by calling the given function for each combination of the elements in the two vectors.
x<-1:6 y<-3:10 m<-outer (x,y,function (x,y) rnorm(x,y)) works as expected. But now when I replace rnorm with rolldie from package (prob) outer complains library (prob) m<-outer (x,y,function (x,y) nrow(rolldie(x,y))) Error in rep("X", times) : invalid 'times' argument In addition: Warning messages: 1: In 1:times : numerical expression has 48 elements: only the first used 2: In 1:nsides : numerical expression has 48 elements: only the first used nrow(rolldie(5,4)) [1] 1024 1) why outer is failing with rolldie? 2) What does the error mean? As a workaround I can do this thru a double loop, but I was hoping to get a more efficient way. Thanks for the help Yousri Fanous Software developer IBM Canada [[alternative HTML version deleted]] ______________________________________________ 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.