Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Construct a table of counts and a table of proportions ( with appropriate comparison proportions to answer the question of interest ) . Use R
Construct a table of counts and a table of proportions with appropriate comparison
proportions to answer the question of interest Use R to obtain these tables, but do NOT copy
and paste those tables into your assignment. Instead, use the tables from R to construct your
own table where you include both the counts and proportions or percentages in the same
table.
R code for table of counts
tbl tablezzz$yyy zzz$xx
rownamestbl c
colnamestbl c
tbl
Replace zzz with the name of the data set
Replace yyy with the name of the response variable
Replace xxx with the name of the explanatory variable
o Give the categories of the rows appropriate names in the rownamestbl line
of code.
Remember, the rows are the categories of the RESPONSE variable. When
a variable is coded numerically, whatever is coded will be in the
first row. Therefore, type an appropriate label for the category
coded between the first set of double quotes and an appropriate
label for the category coded between the second set of double
quotes.
o Give the categories of the columns appropriate names in the colnamestbl
line of code.
Remember, the categories are the categories of the EXPLANATORY
variable. When a variable is coded with text, whatever is comes
first alphabetically will be in the first column. Therefore, type an
appropriate label for the category that comes first alphabetically
between the first set of double quotes and an appropriate label for
the category that comes second alphabetically between the second set
of double quotes.
R code for table of proportions
proptbl prop.tabletbl
proptbl
Note: the last argument tells which total to use in calculation of
proportions. uses column totals would use the row totals
Dataset included as the picture. Thank you!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started