Dear Jean,
Thank you, expand.grid was the function I needed.
/johannes
>
> See
> ?expand.grid
>
> For example,
> df <- expand.grid(L=L, AR=AR, SO=SO, T=T)
> df$y <- fun(df$L, df$AR, df$SO, df$T)
>
> Jean
>
>
> Johannes Radinger wrote on 01/13/2012 12:28:46 PM:
Perhaps repeated use of the outer() function. You could also write a
multi.outer() or adopt one of the solutions here:
http://stackoverflow.com/questions/6192848/how-to-generalize-outer-to-n-dimensions
Michael
On Fri, Jan 13, 2012 at 1:28 PM, Johannes Radinger wrote:
> Hello,
>
> probably it is
See
?expand.grid
For example,
df <- expand.grid(L=L, AR=AR, SO=SO, T=T)
df$y <- fun(df$L, df$AR, df$SO, df$T)
Jean
Johannes Radinger wrote on 01/13/2012 12:28:46 PM:
> Hello,
>
> probably it is quite easy but I can get it: I have
> mulitple numeric vectors and a functi
Hello,
probably it is quite easy but I can get it: I have
mulitple numeric vectors and a function using
all of them to calculate a new value:
L <- c(200,400,600)
AR <- c(1.5)
SO <- c(1,3,5)
T <- c(30,365)
fun <- function(L,AR,SO,T){
exp(L*AR+sqrt(SO)*log(T))
}
How can I get an array or
4 matches
Mail list logo