[R] Alignment and Reshaping of the matrix

From: dinesh kumar <barupal_at_gmail.com>
Date: Sat, 29 Mar 2008 19:21:23 -0500


Dear R users,

I have a matrix like

85 .90 86 .89 87 .98 86 .87
88 .98 90 .78 88 .76 89 .56
90 .67 95 .67 89 .89 90 .87
91 .56 96 .87 90 .76 92.98

each pair of columns present a variable name and next the value. I have matrix with more than 500 rows and column.

Now I want to convert this matrix in to.

85  .90   00   .00   00
86  .00  .89   .00  .87
87  .00   00   .98   00
88  .98   00   .76   00
89  .00   00   .89  .56
90  .67  .78   .76  .87
91  .56   00   .00   00
92  .00  .00   .00  .98
93  .00  .00    00   00
94  .00  .00    00   00
95  .00  .67    00   00
96  .00  .87    00   00

Where first column represent the Variable name.

And if the first matrix is transposed, then how to get the output in which First raw present the variable name.

It will be great help for my research.

Dinesh

-- 
Dinesh Kumar Barupal
Research Associate
Metabolomics Fiehn Lab
UCD Genome Center
451 East Health Science Drive
GBSF Builidng
University of California
DAVIS
95616
http://fiehnlab.ucdavis.edu/staff/kumar

	[[alternative HTML version deleted]]

______________________________________________
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.
Received on Sun 30 Mar 2008 - 00:56:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 30 Mar 2008 - 13:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive