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
. Best, Nello -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jennifer Tickner Sent: Mittwoch, 26. Juni 2013 10:18 To: r-help@r-project.org Subject: [R] Creating a matrix with an unknown variable Hi all I'm trying to create

[R] Creating a matrix with an unknown variable

2013-06-26 Thread Jennifer Tickner
Hi all I'm trying to create a matrix, A, with an unknown variable delta. The code I have so far is: D<-c(-1, -2/3, -1/3, 0, 1/3, 2/3, 1) A<-matrix(NA,nrow=7,ncol=7) for (i in 1:7) { for (j in 1:7) { A[i,j]<-exp(-((D[i]-D[j])/delta)^2) } } Of course, R comes up with an error message be