Lab 1B
Directions: Follow along with the slides and answer the questions in red font in your journal.
cdc
data
.View
your cdc
data and find the columns for height
and gender
(Use the History pane again if you need help to View
your data).
height
a numerical or categorical variable? Why?gender
a numerical or categorical variable? Why?height
and gender
.names
of your cdc
data's variables (Use the code displayed in the History pane to resubmit previously typed commands). Use the code's output to help you complete the following:
cdc
in the Environment pane.str(cdc)
str
ucture of your cdc
data and answer:str()
function outputsbargraph
and a histogram
for each variable.
bargraph
or histogram
is better at visualizing categorical variables? Which is better at visualizing numerical variables?Make a graph that shows the distribution of people's weight.
Arguments can be added to plotting functions to change their appearance. The code below shows how to include the nint
argument which controls the number of intervals in a plot.
Type the command below into your console.
histogram(~weight, data = cdc, nint = 3)
-How did including the argument nint = 3 change the histogram? Try other values for nint.
bargraph (~ ____ , data = ____ , groups = ____ )
groups
argument in your code change the graph?groups
argument to create a histogram
for the height
of males and females.
groups
uses color to differentiate between groups.
histogram (~ ____ | ____ , data = ____ )
drive_text
that's split by gender
to find out.cdc
data, make a graph, and use the graph to describe how drive_text
use differs with this variable.