food and have
it contain the words “pizza”, “ramen”, and “choco-pie”, in that order.
Print the contents of this vector.# Type your CODE in here
'food' <- c("pizza", "Ramen", "Choco-pie")
freq with the
numbers 4, 7, 16, in that order. Print the contents of this vector.# Type your CODE in here
freq <- c(4,7,16)
food vector and the
freq vector into a data frame called
food_diary. Print this data frame.# Type your CODE in here
food_diary <-data.frame(food, freq)
food_diary data frame, extract and
print only the food column.# Type your CODE in here
food_diary <- (food)
food
## [1] "pizza" "Ramen" "Choco-pie"
births.csv into R. Make sure the object is
named births.# Type your CODE in here
setwd("C:/Users/19092/Downloads")
births <- read.csv("births.csv")
head(births) to print out the
first 6 rows of the data frame. Verify that this matches the output of
the lab manual.# Type your CODE in here
head(births)
Gender variable a categorical or
quantitative data type? Why?The gender variable is a categorical data type because it can be placed into two categories or groups.
Meduc variable a categorical or
quantitative data type? Why?The Meduc variable is quantitative data because is has various numerical outputs as its results.
# Type your CODE in here
mean(births$Mage)
## [1] 27.2037
# Type your CODE in here
tally(births$Racedad, format = "proportion")
## X
## Asian Black Other Unknown White
## 0.023523524 0.161161161 0.008508509 0.186686687 0.620120120
# Type your CODE in here
mean(births$weight)*28.35
## [1] 3290.274