[R] how to handle 'multiresponse' variable?

Fan xiao.gang.fan1 at libertysurf.fr
Sun May 18 12:08:08 CEST 2003


There were some discussions in the past on this subject.
AFAK, there're actually useful functions in Frank Harell's package
"hmisc", like mChoice() and summarize(). For the detail
go to the R search page

http://finzi.psych.upenn.edu/search.html

and search

"Frank Harrell type multi-valued variable".

--
Fan

Kosenkov Kirill wrote:
> 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!
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>




More information about the R-help mailing list