Re: [R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread Sergio Fonda
gt; David L Carlson > Department of Anthropology > Texas A&M University > College Station, TX 77840-4352 > > > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Sergio > Fonda > Sent: Friday, June 5, 2015 8:47 AM > To: John Kane > Cc:

Re: [R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread David L Carlson
nda Sent: Friday, June 5, 2015 8:47 AM To: John Kane Cc: R-help Subject: Re: [R] Matrix of indexes to extract sparse data in dataframe Thank you, of course but I can't use that form as I told. My question is about the possibility to enter in a dataframe with a matrix of indices and get the cor

Re: [R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread Sergio Fonda
oes it. > > John Kane > Kingston ON Canada > > > > -Original Message- > > From: sergio.fond...@gmail.com > > Sent: Fri, 5 Jun 2015 15:06:34 +0200 > > To: r-help@r-project.org > > Subject: [R] Matrix of indexes to extract sparse data in dataframe

Re: [R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread John Kane
d1 <- apply(c0, 1, min) I think does it. John Kane Kingston ON Canada > -Original Message- > From: sergio.fond...@gmail.com > Sent: Fri, 5 Jun 2015 15:06:34 +0200 > To: r-help@r-project.org > Subject: [R] Matrix of indexes to extract sparse data in dataframe &g

[R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread Sergio Fonda
I would like to avoid a "for loop" to get a vector of data taken from rows of a data frame for specific columns. An example is the following (I can't apply min to every row of df, this is just an example): c0=data.frame(a=c(3,-2,12,7,-23,17) , b=c(-1,-3,14,2,6,19)) c1=apply(c0,1,which.min) > c1 [1