The variable birthweight measures the infant’s birth
weight in grams.
The variable smoker is a binary variable equal to 1 if
the mother smoked during pregnancy and 0 otherwise. —
How many variables are stored in bwdata?
bwdata <- read.csv("bw_smoking.csv")
length(names(bwdata))
## [1] 12
library(tinytex)
What is the average birth weights for the entire sample?
mean(bwdata$birthweight)
## [1] 3382.934
What is the variance of birth weight for the entire sample?
var(bwdata$birthweight)
## [1] 350656.9
Create a scatterplot of birthweigth (on the y-axis) and smoker (on the x-axis).
plot(x=bwdata$birthweight, y = factor(bwdata$smoker))