Re: [R] modifying arrays within functions

2008-02-05 Thread Bill.Venables
Bill Venables. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martin Elff Sent: Wednesday, 6 February 2008 2:23 AM To: r-help@r-project.org Subject: Re: [R] modifying arrays within functions On Tuesday 05 February 2008 (16:51:41), Konrad BLOCHER wrote

Re: [R] modifying arrays within functions

2008-02-05 Thread Konrad BLOCHER
Got it Thanks > On Tuesday 05 February 2008 (16:51:41), Konrad BLOCHER wrote: >> Hi, >> >> I'm pretty new to R and seem to be having difficulties with writing a >> function that would change an array and keep the change after the >> function >> finishes its work. >> > It seems you want this: > > X

Re: [R] modifying arrays within functions

2008-02-05 Thread Wittner, Ben, Ph.D.
t; -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Konrad BLOCHER > Sent: Tuesday, February 05, 2008 10:52 AM > To: r-help@r-project.org > Subject: [R] modifying arrays within functions > > > Hi, > > I'm pretty

Re: [R] modifying arrays within functions

2008-02-05 Thread Konrad BLOCHER
Thanks that works fine but still doesnt keep the result only prints it. How can I make it retain the value in the variable? Thanks, > You want to have X as an argument to your function > and return X at the end of it: > > addition <- function(x, a) { > x[1,1] <- x[1,1] + a > x > } > > add

Re: [R] modifying arrays within functions

2008-02-05 Thread Martin Elff
On Tuesday 05 February 2008 (16:51:41), Konrad BLOCHER wrote: > Hi, > > I'm pretty new to R and seem to be having difficulties with writing a > function that would change an array and keep the change after the function > finishes its work. > It seems you want this: X<-array(1,dim=c(2,2)) addition<

Re: [R] modifying arrays within functions

2008-02-05 Thread john seers (IFR)
CTED] On Behalf Of Konrad BLOCHER Sent: 05 February 2008 15:52 To: r-help@r-project.org Subject: [R] modifying arrays within functions Hi, I'm pretty new to R and seem to be having difficulties with writing a function that would change an array and keep the change after the function finishes

[R] modifying arrays within functions

2008-02-05 Thread Konrad BLOCHER
Hi, I'm pretty new to R and seem to be having difficulties with writing a function that would change an array and keep the change after the function finishes its work. in other words I have an array of 1'sX<-array(1,dim=c(2,2)) I want to add a number to X[1,1] by means of a function called

[R] modifying arrays within functions

2008-02-05 Thread Konrad BLOCHER
Hi, I'm preetty new to R and seem to be having difficulties with writing a function that would change an array and keep the change after the function finishes its work. in other words I have an array of 1'sX<-array(1,dim=c(2,2)) I want to add a number to X[1,1] by means of a function called