: 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
: 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
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
: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
-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
: (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
: 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
: 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
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
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
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
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)
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
13 matches
Mail list logo