Thanks to all who replied to this question. Jorge's script worked a treat. Hi, can someone please tell me how to convert a square matrix to a list in R? i.e. I want to convert from: a b c a 1 1 1 b 2 2 2 c 3 3 3 to: a a 1 a b 1 a c 1 b a 2 b b 2 b c 2 c a 3 c b 3 c c 3 Thanks, Adrian." Adrian Pinder Senior Research Scientist Wetland Research Dept. Environment and Conservation P.O. Box 51 Wanneroo 6946 Western Australia adrian.pinder at dec.wa.gov.au (W) apnlp1 at optusnet.com.au (H) http://www.naturebase.net/content/view/2475/1338/ ph (61) 08 94055153, fax (61) 08 93061641 mob. 0438 935 932 This email, together with any attachments, is intended for the addressee only. It may contain confidential or privileged information. If you are not the intended recipient of this email, please notify the sender, delete the email and attachments from your system and destroy any copies you may have taken of the email and its attachments. Duplication or further distribution by hardcopy, by electronic means or verbally is not permitted without permission.