On Thu, 13 Sep 2007, Abu Naser wrote:
>
> Hello all R user,
>
> I am very new with r I have been wondering whether anyone could help me.
> I have a 23000 row and 273 colums. What I want to do is to calculate unit
vector for every
> 3 colums along the row. Could you please advise me how to do that using R?
A simple example might help us to understand what it is you want.
Do you wish to convert a 23000 by 273 matrix to a 23000*3 by 273/3 matrix?
If so and your matrix is 'x',
dim(x) <- c( 23000*3, 273/3 )
will do.
Do you wish to find the projection of the vector (1,1,1) onto each set of
x[ i, 1:3 + (j-1)*3 ]? Then
apply( array( x, dim=c(23000, 3, 273/3 ) ), c(1,3), mean )
seems like what you would want.
As is stated at the end of your email:
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html and provide commented,
minimal, self-contained, reproducible code.
This will make it more likely that readers of your message can help you.
>
> with regards,
> Abu
> _________________________________________________________________
> 100?s of Music vouchers to be won with MSN Music
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901