Re: [R] Creating a matrix with an unknown variable

2013-06-26 Thread David Carlson
gy Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Blaser Nello Sent: Wednesday, June 26, 2013 11:03 AM To: Jennifer Tickner; r-help@r-project.org Subject: Re: [R] Creating a m

Re: [R] Creating a matrix with an unknown variable

2013-06-26 Thread Blaser Nello
You have to define a function. For instance: Afct <- function(delta){ D <- c(-1, -2/3, -1/3, 0, 1/3, 2/3, 1) Dmat <- matrix(D, nrow=7, ncol=7) Smat <- Dmat-t(Dmat) A <- exp(-(Smat/delta)^2) return(A) } Afct(2) Also try to avoid loops... Best, Nello ---