[R] loop: results for all inputs

Gabor Grothendieck ggrothendieck at gmail.com
Fri Apr 14 03:04:31 CEST 2006


See:

https://www.stat.math.ethz.ch/pipermail/r-help/2006-March/089888.html

and succeeding messages in thread.

On 4/13/06, gynmeerut <gynmeerut at indiatimes.com> wrote:
> Dear R users,
>
>
>  I am using a loop that does matrix multiplication in a manner
>
>
> (A%*%B)%*%(A)
>
>
>  Here A is a row of data frame D of order(200x4). B is a (4x4). No need to say D[j,] is 1x4
>
>
> so I am using
>
>
>  for(j in seq(0.1,20,by=0.1)){
>
>
>  S&lt;- (D[j,]%*%B)%*%(D[j,])
>
>
> print(S)
>
>
> }
>
>
> As a result I am geting only one value of S, which comes using j=20.
>
>
> I need all 200 values of S so that I can use that for further analysis. Means I need a 200x1 column.
>
>
> Any help will be appreciated.
>
>
>  Thanks,
>
>
> GS Indiatimes Email now powered by APIC Advantage. Help!
> " " Help
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list