[R] how to handle 'multiresponse' variable?

Kosenkov Kirill Kosenkov.Kirill at nac.spb.ru
Sat May 17 14:15:20 CEST 2003


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!




More information about the R-help mailing list