Re: [R] Multiple Conditional Tranformations

2006-11-25 Thread Muenchen, Robert A (Bob)
A (Bob) Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Multiple Conditional Tranformations And here is a variation: transform(mydata, score1 = (2 + (gender == m)) * q1 + q2, score2 = score1 + 0.5 * q1 ) or transform( transform(mydata, score1 = (2 + (gender == m)) * q1 + q2), score2

Re: [R] Multiple Conditional Tranformations

2006-11-25 Thread Gabor Grothendieck
] Sent: Saturday, November 25, 2006 12:39 AM To: Muenchen, Robert A (Bob) Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Multiple Conditional Tranformations And here is a variation: transform(mydata, score1 = (2 + (gender == m)) * q1 + q2, score2 = score1 + 0.5 * q1 ) or transform

Re: [R] Multiple Conditional Tranformations

2006-11-25 Thread Muenchen, Robert A (Bob)
-Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Saturday, November 25, 2006 7:37 AM To: Muenchen, Robert A (Bob) Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Multiple Conditional Tranformations Firstly your outline does not check once, it checks twice. First it check

Re: [R] Multiple Conditional Tranformations

2006-11-25 Thread Gabor Grothendieck
@stat.math.ethz.ch Subject: Re: [R] Multiple Conditional Tranformations Firstly your outline does not check once, it checks twice. First it check for m and then it redundantly checks for f. On the other hand the two variations in my post do check once. Although substantially longer than the solutions

Re: [R] Multiple Conditional Tranformations

2006-11-25 Thread Gabor Grothendieck
, Robert A (Bob) Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Multiple Conditional Tranformations Firstly your outline does not check once, it checks twice. First it check for m and then it redundantly checks for f. On the other hand the two variations in my post do check once

Re: [R] Multiple Conditional Tranformations

2006-11-25 Thread Muenchen, Robert A (Bob)
, 2006 11:11 AM To: Muenchen, Robert A (Bob) Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Multiple Conditional Tranformations Here is a correction: do.call(rbind, by(mydata, 1:nrow(mydata), function(x) switch(as.character(x$gender), m = transform(x, score1 = 3*q1+q2, score2 = 3.5*q1+q2), f

[R] Multiple Conditional Tranformations

2006-11-24 Thread Muenchen, Robert A (Bob)
Greetings, I'm learning R and I'm stuck on a basic concept: how to specify a logical condition once and then perform multiple transformations under that condition. The program below is simplified to demonstrate the goal. Its results are exactly what I want, but I would like to check the

Re: [R] Multiple Conditional Tranformations

2006-11-24 Thread Muenchen, Robert A (Bob)
) [mailto:[EMAIL PROTECTED] Sent: Friday, November 24, 2006 8:45 PM To: Muenchen, Robert A (Bob) Subject: RE: [R] Multiple Conditional Tranformations I'm not sure if I understand your question but I don't think you need iflelse statements. myscore-numeric(q1) ( because I'm not sure how

Re: [R] Multiple Conditional Tranformations

2006-11-24 Thread Muenchen, Robert A (Bob)
= -Original Message- From: Leeds, Mark (IED) [mailto:[EMAIL PROTECTED] Sent: Friday, November 24, 2006 8:45 PM To: Muenchen, Robert A (Bob) Subject: RE: [R] Multiple Conditional Tranformations I'm not sure if I understand your question but I don't think you need iflelse statements. myscore

Re: [R] Multiple Conditional Tranformations

2006-11-24 Thread Muenchen, Robert A (Bob)
Good idea. I'm still getting used to how flexible R is on substitutions like that! -Bob -Original Message- From: Leeds, Mark (IED) [mailto:[EMAIL PROTECTED] Sent: Friday, November 24, 2006 10:20 PM To: Muenchen, Robert A (Bob) Subject: RE: [R] Multiple Conditional Tranformations You

Re: [R] Multiple Conditional Tranformations

2006-11-24 Thread Gabor Grothendieck
: Friday, November 24, 2006 8:45 PM To: Muenchen, Robert A (Bob) Subject: RE: [R] Multiple Conditional Tranformations I'm not sure if I understand your question but I don't think you need iflelse statements. myscore-numeric(q1) ( because I'm not sure how to initialize a list so initialize a vector

Re: [R] Multiple Conditional Tranformations

2006-11-24 Thread Gabor Grothendieck
) [mailto:[EMAIL PROTECTED] Sent: Friday, November 24, 2006 8:45 PM To: Muenchen, Robert A (Bob) Subject: RE: [R] Multiple Conditional Tranformations I'm not sure if I understand your question but I don't think you need iflelse statements. myscore-numeric(q1) ( because I'm not sure how