search for: ashtari

Displaying 3 results from an estimated 3 matches for "ashtari".

2024 Jun 03
1
R code for overlapping variables -- count
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 at 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 try...
2024 Jun 01
2
R code for overlapping variables -- count
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]]
2024 Jun 02
2
R code for overlapping variables -- count
Dear Shadee, If you have a data.frame with the following columns: n = 100; # population size x = data.frame( ??????Sex = sample(c("M","F"), n, T), ??????Country = sample(c("AA", "BB", "US"), n, T), ??????Income = as.factor(sample(1:3, n, T)) ) # Dummy variable ONE = rep(1, nrow(x)) r = aggregate(ONE ~ Sex + Income + Country, length, data = x)