RE: [R] Recoding a multiple response question into a series of 1, 0 variables

2004-06-08 Thread Philippe Grosjean
Hello, Here is a slightly more sophisticate and fully vectorized, answer. RecodeChoices - function(mat) { # Make sure mat is a matrix (in case it is a data.frame) mat - as.matrix(mat) # Get dimensions of the matrix Dim - dim(mat) Nr - Dim[1] Nc -

Re: [R] Recoding a multiple response question into a series of 1, 0 variables

2004-06-07 Thread Jonathan Baron
On 06/07/04 21:28, Greg Blevins wrote: Hello R folks. 1) The question that generated the data, which I call Qx: Which of the following 5 items have you performed in the past month? (multipe response) 2) How the data is coded in my current dataframe: The first item that a person selected is

Re: [R] Recoding a multiple response question into a series of 1, 0 variables

2004-06-07 Thread Jonathan Baron
On 06/07/04 22:45, Jonathan Baron should have written: for (i in [whatever]) Y[i,][X[i,]] - 1 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!