workshop <- c(1, 2, 1, 2, 1, 2, 1, 2) workshop table(workshop) mean(workshop) gender[workshop == 2]
workshop <- c(1, 2, 1, 2, 1, 2, 1, 2) workshop <- factor(workshop) workshop table(workshop) mean(workshop) #generates error now. gender[workshop == 2] gender[workshop == "2"]
workshop <- c(1, 2, 1, 2, 1, 2, 1, 2) workshop <- factor( workshop, levels = c( 1, 2, 3, 4), labels = c("R", "SAS", "SPSS", "Stata") )
workshop <- c(1, 2, 1, 2, 1, 2, 1, 2) workshop <- factor( workshop, levels = c( 1, 2), labels = c("R","SAS") )
workshop table(workshop) gender[workshop == 2] gender[workshop == "2"] gender[workshop == "S"]