On 11-09-2013, at 09:38, Elaine Kuo <elaine.kuo...@gmail.com> wrote:
> Dear list, > > I want to retrieve a specific data from a matrix with 3000 columns. > The matrix has island ID as its rows and species ID as its columns. > There are 20 rows and 3000 columns in the matrix. > (Island ID: Species 1- Species 20/ species ID: Species 1- Species 3000) > The contents of the matrix grids is 1 or 0, for presence and absence. > > Now I would like to check in Island 1 which species is 1. (Island 1 as row > 2) > Please kindly advise how to code the command and thank you in advance. What have you tried? Something like this perhaps which(datamatrix[2,] == 1) or which(datamatrix[2,] == 1L) Berend ______________________________________________ R-help@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.