In a my previous Pew Data post, we started to break down how to identify variables of a large, 197 variable 2,008 person response, data set. Toward the end of the post we had broken the data set into a state-by-state breakdown.
I would like to explore more of the approval ratings by state and would like to generate some new variables in the process. Specifically, I would be interested in generating percentages for approval ratings for our departed (from office) President Obama (miss you already!).
> Frequency_Approval = table(pew.data.health$q1) > Percentage_Approval = table(pew.data.health$q1)/(2008*0.01) > cbind(Frequency_Approval,Percentage_Approval)
As you can see, we identified the categorical variable of frequency with it’s three levels (Approve, Disapprove, Don’t know/Refused), and created a percentage distribution based on those three levels. the cbind function was used to tie those newly created variables together in one table.