[R] Creating a large matrix

Vehbi Sinan Tunalioglu vst at vsthost.com
Sun Jun 5 17:15:48 CEST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You are able to store such a huge matrix in R, if you ask for it...
Furthermore, "table" command might help you:

Help page for "table" says:

Cross Tabulation and Table Creation
Description:
     'table' uses the cross-classifying factors to build a contingency
     table of the counts at each combination of factor levels.

Take a look at the examples on the Help page.

- --vst


Des Callaghan wrote:
> Dear all,
> 
> I have a set of data that is 2 columns wide and 35,000 rows long (see
> extract below).  The first column contains codes for tetrads (2km x 2km
> squares within NW England) and the second column has the names of moss
> species present within each tetrad.  I wish to convert this into a matrix
> where rows are labelled by 'Tetrad', columns are labelled by 'Moss species'
> and each cell contains a 1 or 0 to denote the presence or absence of the
> moss species within each tetrad.  This would be a matrix measuring 796 rows
> by 417 columns.  Am I able to do this within R?  I ran into problems trying
> to do it using the crosstab query in MS Access and the pivot table function
> on MS Excel because there are too many columns for these software to handle.
> Thanks very much in advance for any help.
> 
> All the best,
> Des
> 
> Tetrad	Moss species
> SD20S	Amblystegium serpens var. serpens
> SD20S	Barbula convoluta
> SD21S	Brachythecium albicans
> SD20J	Brachythecium rutabulum
> SD30S	Bryum argenteum
> SD20S	Bryum capillare
> 
> ______________________________________________
> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCoxcibCSiwEAcSbwRAkuqAKCjtJT9mZVsi/4oVesqi40L1ZaEFwCgpiWj
v/HYFWLNg/3+kpv6OW8yfTw=
=J+Vs
-----END PGP SIGNATURE-----




More information about the R-help mailing list