I don't know exactly what you mean, but perhaps this will get you started:

This:
subset(Data, X4==1 & X5==1, select=c(X1, X2, X3))
will extract the continuous variables in the cross-tabulation cell for
which X4 and X5 are both equal to one. Similar commands will extract the
other cells.

Of course, this gets tedious if your categorical variables have more than
two levels.

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 6/17/16, 5:25 AM, "R-help on behalf of Gafar Matanmi Oyeyemi"
<r-help-boun...@r-project.org on behalf of gmoyey...@gmail.com> wrote:

>Hello everyone,
>I'm writing a function in R but was stalked.
>I have a data set that contains mixture of categorical and continuous
>variables. I want to use the categorical variables to cross-tabulate the
>data and extract the observations in the resulting cells that contain only
>continuous variables.
>
>Data.
>X1   X2   X3   X4   X5
>2.4  5.3  4.8    0      1
>4.2  3.2  4.8    1      1
>3.3  4.4  5.1    0      0
>5.2  1.1  2.5    1      0
>.
>.
>.
>3.7  2.8  3.8    0      1
>
>Thanks.
>
>       [[alternative HTML version deleted]]
>
>______________________________________________
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to