Skip to content
Back to formatted view

Raw Message

Message-ID: <3EC627D8.1020309@nac.spb.ru>
Date: 2003-05-17T12:15:20Z
From: Kosenkov Kirill
Subject: how to handle 'multiresponse' variable?

Hello!

I have dataset where one variable is 'multiresponse', like this:
[1] "1 2" "1 2 3" "4" "1 4" "4 3" etc.
'responses' separated by space. observations in different 'rows' 
of data.frame.
I can do strsplit(data$var,' ') and make a list, where multiple 
responses are elements of character vectors, like this:
  $ P124               :List of 2956
   ..$ : chr  "2" "4"
   ..$ : chr  "1" "2"
   ..$ : chr "NA"
   ..$ : chr  "3" "4"
   ..$ : chr "3"

I need to compute crosstabulation on this variable, to make 
crosstabulation where this variable is a factor variable 
(responses of this variable are categories, in which i need to 
compute distributions of other variables). And i need to do 
crosstabulation with 'weights', like in xtabs(w~f1+f2).

Is any way exists to do such things with 'multiresponse' variables 
in R or i need to write my own functions to handle it?

Thanks!