Re: [R] Conditional looping over a set of variables in R

2010-10-27 Thread David Herzberg
: Tuesday, October 26, 2010 9:23 AM To: David Herzberg Cc: Petr PIKAL; r-help@r-project.org Subject: Re: [R] Conditional looping over a set of variables in R I would still recommend vector_of_column_number - apply(yourdata, 1, match, x=1) as the simplest way if you only want the number of the column

Re: [R] Conditional looping over a set of variables in R

2010-10-27 Thread Peter Ehlers
: dav...@wpspublish.com -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, October 26, 2010 9:23 AM To: David Herzberg Cc: Petr PIKAL; r-help@r-project.org Subject: Re: [R] Conditional looping over a set of variables in R I would still recommend

Re: [R] Conditional looping over a set of variables in R

2010-10-26 Thread Petr PIKAL
Cc: r-help@r-project.org Subject: Re: [R] Conditional looping over a set of variables in R David, here I'm referring to your data as testmat, a matrix of 140 columns and 1500 rows, but the same or similar notation can be applied to data frames in R. If I understand correctly, you

Re: [R] Conditional looping over a set of variables in R

2010-10-26 Thread David Herzberg
:00 Subject: Re: [R] Conditional looping over a set of variables in R Hi r-help-boun...@r-project.org napsal dne 25.10.2010 20:41:55: Adrienne, there's one glitch when I implement your solution below. When the loop encounters a case with no data at all (that is, all 140 item responses

Re: [R] Conditional looping over a set of variables in R

2010-10-26 Thread Peter Ehlers
-project.orgr-help@r-project.org Sent: Tue, Oct 26, 2010 06:43:09 GMT+00:00 Subject: Re: [R] Conditional looping over a set of variables in R Hi r-help-boun...@r-project.org napsal dne 25.10.2010 20:41:55: Adrienne, there's one glitch when I implement your solution below. When the loop encounters

Re: [R] Conditional looping over a set of variables in R

2010-10-25 Thread David Herzberg
: (310)478-7838 email: dav...@wpspublish.com From: wootten.adrie...@gmail.com [mailto:wootten.adrie...@gmail.com] On Behalf Of Adrienne Wootten Sent: Friday, October 22, 2010 9:09 AM To: David Herzberg Cc: r-help@r-project.org Subject: Re: [R] Conditional looping over a set of variables in R

Re: [R] Conditional looping over a set of variables in R

2010-10-24 Thread David Herzberg
: wootten.adrie...@gmail.com [mailto:wootten.adrie...@gmail.com] On Behalf Of Adrienne Wootten Sent: Friday, October 22, 2010 9:09 AM To: David Herzberg Cc: r-help@r-project.org Subject: Re: [R] Conditional looping over a set of variables in R David, here I'm referring to your data as testmat

Re: [R] Conditional looping over a set of variables in R

2010-10-24 Thread Peter Ehlers
: Friday, October 22, 2010 9:52 AM To: David Herzberg; r-help@r-project.org Subject: RE: [R] Conditional looping over a set of variables in R You were a bit vague about the format of your data. I'm assuming all columns were numeric and the entries are one of 0, 1, and NA (missing value). I made

Re: [R] Conditional looping over a set of variables in R

2010-10-24 Thread Peter Ehlers
Phone: (310)478-2061 x144 FAX: (310)478-7838 email: dav...@wpspublish.com -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Friday, October 22, 2010 9:52 AM To: David Herzberg; r-help@r-project.org Subject: RE: [R] Conditional looping over a set of variables in R

Re: [R] Conditional looping over a set of variables in R

2010-10-24 Thread Gabor Grothendieck
On Sun, Oct 24, 2010 at 2:54 PM, Peter Ehlers ehl...@ucalgary.ca wrote: Whoops, got an extra comma in there somehow; should be:  apply(d, 1, function(x) match(1, x)) A slight variation on this would be: apply(d, 1, match, x = 1) -- Statistics Software Consulting GKX Group, GKX

Re: [R] Conditional looping over a set of variables in R

2010-10-22 Thread Adrienne Wootten
David, here I'm referring to your data as testmat, a matrix of 140 columns and 1500 rows, but the same or similar notation can be applied to data frames in R. If I understand correctly, you are looking for the first response (column) where you got a value of 1. I'm assuming also that since your

Re: [R] Conditional looping over a set of variables in R

2010-10-22 Thread William Dunlap
You were a bit vague about the format of your data. I'm assuming all columns were numeric and the entries are one of 0, 1, and NA (missing value). I made a little function to generate random data of that format for testing purposes: makeData - function (nrow = 1500, ncol = 140, pMissing = 0.1)

Re: [R] Conditional looping over a set of variables in R

2010-10-22 Thread David Herzberg
email: dav...@wpspublish.com -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Friday, October 22, 2010 9:52 AM To: David Herzberg; r-help@r-project.org Subject: RE: [R] Conditional looping over a set of variables in R You were a bit vague about the format of your