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

2010-10-22 Thread David Herzberg
Here's the problem I'm trying to solve in R: I have a data frame that consists of about 1500 cases (rows) of data from kids who took a test of listening comprehension. The columns are their scores (1 = correct, 0 = incorrect, . = missing) on 140 test items. The items are numbered sequentially a

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

2010-10-22 Thread David Herzberg
-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 You were a bit vague about the format of

[R] Combining the values of two variables into one

2010-10-22 Thread David Herzberg
I start with: v1<-c(1,3,5,7) v2<-c(2,4,6,8) And I want to end up with: v3<-c(12,34,56,78) How do I get there? Thanks, David S. Herzberg, Ph.D. Vice President, Research and Development Western Psychological Services 12031 Wilshire Blvd. Los Angeles, CA 90025-1251 Phone: (310)478-2061 x144 FAX

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

2010-10-23 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 testm

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

2010-10-25 Thread David Herzberg
10)478-2061 x144 FAX: (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 s

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

2010-10-26 Thread David Herzberg
Thank you - I will try this solution as well. Sent via DROID X -Original message- From: Petr PIKAL To: David Herzberg Cc: Adrienne Wootten , "r-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 i

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

2010-10-27 Thread David Herzberg
.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 vector_of_column_number <- apply(yourdata, 1, match, x=1) as the simplest way if you only want the

[R] Determining a basal correct count

2010-10-28 Thread David Herzberg
Here's another interesting problem: if you recall I have a data frame (LCvars1) that consists of about 1500 cases (rows) of data from kids who took a test of listening comprehension. The columns are their scores (1 = correct, 0 = incorrect, . = missing) on 140 test items. The items are numbered

Re: [R] Determining a basal correct count

2010-10-28 Thread David Herzberg
Thank you Phil - I'll give this a try. I do have some empty rows, so I'll have to deal with that eventually. Dave Sent via DROID X -Original message- From: Phil Spector To: David Herzberg Cc: "r-help@r-project.org" Sent: Thu, Oct 28, 2010 23:39:34 GMT+0

Re: [R] Determining a basal correct count

2010-11-01 Thread David Herzberg
4:59 PM To: David Herzberg Cc: r-help@r-project.org Subject: Re: [R] Determining a basal correct count David - I think changing apply(x,1,function(x)rle(x[which(x==1)[1]:length(x)])$lengths[1]) to apply(x,1,function(x)if(!any(x==1)) 0 else rle(x[which(x==1)[1]:length(x)])$lengths[1

Re: [R] Determining a basal correct count

2010-11-24 Thread David Herzberg
ssage- From: Phil Spector [mailto:spec...@stat.berkeley.edu] Sent: Thursday, October 28, 2010 4:59 PM To: David Herzberg Cc: r-help@r-project.org Subject: Re: [R] Determining a basal correct count David - I think changing apply(x,1,function(x)rle(x[which(x==1)[1]:length(x)])$lengths[1]) to appl