lippe massicotte
To: "r-help@r-project.org"
Cc:
Sent: Friday, October 4, 2013 9:49 AM
Subject: [R] Trying to avoid nested loop
Dear R users.
I'm trying to avoid using nested loops in the following code but I'm not sure
how to proceed. Any help would be greatly appreciated.
philippe massicotte
To: "r-help@r-project.org"
Cc:
Sent: Friday, October 4, 2013 9:49 AM
Subject: [R] Trying to avoid nested loop
Dear R users.
I'm trying to avoid using nested loops in the following code but I'm not sure
how to proceed. Any help would be greatly appreci
Thank you for your answer. This is what I needed.
> From: s.elli...@lgcgroup.com
> To: r-help@r-project.org
> Date: Fri, 4 Oct 2013 15:13:49 +0100
> Subject: Re: [R] Trying to avoid nested loop
>
>
> > I'm trying to avoid using nested loops in the following cod
> I'm trying to avoid using nested loops in the following code but I'm
> not sure how to proceed. Any help would be greatly appreciated.
> With regards,Phil
> X = matrix(rnorm(100), 10, 10)
> result = 0
> for(m in 1:nrow(X)){
> for(n in 1:ncol(X)){
> if(X[m,n] != 0){
Dear R users.
I'm trying to avoid using nested loops in the following code but I'm not sure
how to proceed. Any help would be greatly appreciated.
With regards,Phil
X = matrix(rnorm(100), 10, 10)
## Version with nested loopsresult = 0
for(m in 1:nrow(X)){ for(n in 1:ncol(X)){if(X[m,n] !=
5 matches
Mail list logo