Re: [R] programing problem with for( )

2010-02-01 Thread David Winsemius
On Feb 1, 2010, at 8:20 AM, marlene marchena wrote: Hi, Thanks a lot it works. But as Ted remarked it was a simple case of a more complex procedure. Here is what I trying to do (sorry I was not able to find another example) I wrote a fuction that I call bullexe(phi,theta,L) the code of

Re: [R] programing problem with for( )

2010-02-01 Thread marlene marchena
Hi, Thanks a lot it works. But as Ted remarked it was a simple case of a more complex procedure. Here is what I trying to do (sorry I was not able to find another example) I wrote a fuction that I call bullexe(phi,theta,L) the code of this function is at the end of this mail. I want to run diff

Re: [R] programing problem with for( )

2010-02-01 Thread Ted Harding
On 01-Feb-10 11:29:40, marlene marchena wrote: > Hi R-users > > I'm writing a code to run a fuction but I found an error that I can't > fix. I > reproduced the error with a simple example. > > The correct answer is k but I can't fill my s matrix. What I'm doing > wrong? > > > s<-matrix(data=NA

Re: [R] programing problem with for( )

2010-02-01 Thread Henrique Dallazuanna
Try this: s <-matrix(data=NA,nrow=1,ncol=5 ) for( i in 1:5) { k <- sqrt(i) s[,i] <- k print(k) } Or: s[] <- sqrt(1:5) On Mon, Feb 1, 2010 at 9:29 AM, marlene marchena wrote: > Hi R-users > > I'm writing a code to run a fuction but I found an error that I can't fix. I > reproduced t

[R] programing problem with for( )

2010-02-01 Thread marlene marchena
Hi R-users I'm writing a code to run a fuction but I found an error that I can't fix. I reproduced the error with a simple example. The correct answer is k but I can't fill my s matrix. What I'm doing wrong? s<-matrix(data=NA,nrow=1,ncol=5 ) s for(i in 1:5) { k=sqrt(i) s[,i