Thanks Michael, this worked great. Stephen -- View this message in context: http://r.789695.n4.nabble.com/Trying-to-create-a-function-to-extract-values-from-a-matrix-tp3944737p3945236.html Sent from the R help mailing list archive at Nabble.com.