Lab 3B
Directions: Follow along with the slides, completing
the questions in blue on your
computer, and answering the questions in red in your
journal.
Space, Click, Right Arrow or swipe left to move to
the next slide.
Rather than export-ing the data and then upload-ing and importing-ing it, we’ll pull the data straight from the webpage into R.
You can find the data online here:
Click on the Import Dataset button under the Environment tab.
Before importing, change the following Import Options:
lungs
"1"
for males, "0"
for
females."1"
, or
non-smoker "0"
.What is the effect of childhood smoking on lung health?
"age"
,
"lung_cap"
, "height"
,
"gender"
,"smoker"
, in that order.gender
and
smoker
from numeric to character.gender
and smoker
:
gender
, use recode
to change
"1"
to "Male"
and "0"
to
"Female"
.smoker
, use recode
to change
"1"
to "Yes"
and "0"
to
"No"
.lungs
data is from an observational study.lungs
data to create an
xyplot
of age
and
lung_cap
.
Do people who smoke tend to have lower lung capacity than those who do not smoke?