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
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
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
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
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<
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
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
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
8 matches
Mail list logo