On 2024-12-10 11:36 a.m., Christofer Bogaso wrote:
Hi,
I have below code
FN1 = function(x, y) 3
outer(1:9, 1:9, FN1)
With above I get error as below
Error in dim(robj) <- c(dX, dY) :
dims [product 81] do not match the length of object [1]
Could you please help to understand why is it fa
outer() expects a return value with the same length as that of x.
You could change the code to rep(3, length(x))
Or if you don't want to change the code of the function, you could make a
wrapper and use that instead:
function (x, y)
{
v <- FN1(x, y)
if (length(v) != 1) v else rep(v, lengt
2 matches
Mail list logo