NOBUILD/Sandbox/expandgrid.R

x <- 1:3
z <- c(10,20,30,40)
grd <- as.matrix(expand.grid(VarX=x,VarZ=z))

testfun <- function(XY){
  sum(XY)
}

Res <- apply(grd, 1, testfun)

matrix(Res, ncol=length(z))
abarbour/deform documentation built on Dec. 5, 2024, 1:55 p.m.