Hi! I am new to R Studio...So first, I created a new variable, "school", which works. There's a variety of educational attainment levels...so I grouped 3 different types of college degrees to just create the category/subset "degree"(variable -> school=="4+") the 2nd other variable is cognitive difficulty, which is dichotomous, (variable -> diffrem==1)
degree <-subset(data, school=="4+") cogn <- subset(data, diffrem==1)
Next, I found the average/mean of people in the sample with college degrees and I found the mean of people in the sample that have a cognitive difficulty. I'm trying to find the mean of people in the sample with a college degree AND a cognitive difficulty. I'll paste the 2 codes I brainstormed (they both ran but gave me very different numbers)...I'm having trouble with the "order" of the code and what comes before and after the $ .
mean_cognxdegree <- mean(cogn $ school=="4+") mean_cognxdegree2 <- mean(degree $ diffrem==1)