[R] numeric index of a matrix column name ?

From: <vincent_at_7d4.com>
Date: Sat 29 Oct 2005 - 00:50:19 EST

Dear All,

I have written the following small code in order to return the numeric index of a given matrix column ascii name. It works, but there is perhaps/probably a predefined function which does that ?
If yes, thanks for pointing me to it.

# input : a matrix M and a column ascii name
# output : the numeric index of the column
colnameindex = function(M , colname0)
colsnames = names(M[1,]);
theindex = which(colsnames==colname0);


R-help@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 Received on Sat Oct 29 00:55:21 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:52 EST