[R] R code for overlapping variables -- count

peter dalgaard pd@|gd @end|ng |rom gm@||@com
Mon Jun 3 11:01:52 CEST 2024


If they are binary (0/1 dummies), can't you just "&" them as in 

table(Female & USA & MidIncome)

(or sum() if you don't care about the number of 0s)

-pd

> On 2 Jun 2024, at 00:31 , Shadee Ashtari <shadee.ashtari using gmail.com> wrote:
> 
> Hi!
> 
> I am trying to find the code for how to get counts for intersectional
> variables. For example, I have three unique categorical variables --
> "Female," "USA," and "MidIncome" -- and I'm trying to see how many people I
> have at the intersection of the three.
> 
> Thank you so much,
> Shadee
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-help mailing list