library(tidyverse)
library(openintro)
Exercise 1
What command would you use to extract just the counts of girls
baptized? ANS: The command used to extract just the counts of girls
baptized is in the r code below
## [1] 4683 4457 4102 4590 4839 4820 4928 4605 4457 4952 4784 5332 5200 4910 4617
## [16] 3997 3919 3395 3536 3181 2746 2722 2840 2908 2959 3179 3349 3382 3289 3013
## [31] 2781 3247 4107 4803 4881 5681 4858 4319 5322 5560 5829 5719 6061 6120 5822
## [46] 5738 5717 5847 6203 6033 6041 6299 6533 6744 7158 7127 7246 7119 7214 7101
## [61] 7167 7302 7392 7316 7483 6647 6713 7229 7767 7626 7452 7061 7514 7656 7683
## [76] 5738 7779 7417 7687 7623 7380 7288
Exercise 2
Is there an apparent trend in the number of girls baptized over the
years? How would you describe it? (To ensure that your lab report is
comprehensive, be sure to include the code needed to make the plot as
well as your written interpretation.) ANS: It shows a downward trend at
first that ends around year 1650 and then shows an upward trend
movement; this depicts first a negative correlation meaning with an
increase in the years, there was a decrease in the number of girls born
which changes around 1650, showing more of a positive correlation that
with each new year shows an increase in the number of girls being
baptized.
ggplot(data = arbuthnot, aes(x = year, y = girls)) +
geom_point()

Exercise 3
Now, generate a plot of the proportion of boys born over time. What
do you see? ANS: The plot below shows a positive correlation as it shows
an upward pattern.
ggplot(data = arbuthnot, aes(x = year, y = boys)) +
geom_point()

Exercise 4
What years are included in this data set? What are the dimensions of
the data frame? What are the variable (column) names? ANS:Years
included: 1940 to 2002. Dimensions: 63 observations(rows) and 3
variables(columns). Names of the variables: Year, boys, girls
## Rows: 63
## Columns: 3
## $ year <dbl> 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950…
## $ boys <dbl> 1211684, 1289734, 1444365, 1508959, 1435301, 1404587, 1691220, 1…
## $ girls <dbl> 1148715, 1223693, 1364631, 1427901, 1359499, 1330869, 1597452, 1…
Exercise 5
How do these counts compare to Arbuthnot’s? Are they of a similar
magnitude?
The counts of the present dataset appear smaller in size as the
present as 63 observations and 3 variables as compared to the arbuthnot
dataset which is composed 82 observations and 5 variables
## # A tibble: 1 × 1
## n
## <int>
## 1 63
Exercise 6
Make a plot that displays the proportion of boys born over time. What
do you see? Does Arbuthnot’s observation about boys being born in
greater proportion than girls hold up in the U.S.? Include the plot in
your response. ANS: No I do not think the observations of boys being
born in greater proportion than girls hold up in the US
ggplot(data = present, aes(x = year, y = boys)) +
geom_point()

Exercise 7
In what year did we see the most total number of births in the U.S.?
ANS: According to the data presented; 1961.
present |>
arrange(desc(present$boys + present$girls))
## # A tibble: 63 × 3
## year boys girls
## <dbl> <dbl> <dbl>
## 1 1961 2186274 2082052
## 2 1960 2179708 2078142
## 3 1957 2179960 2074824
## 4 1959 2173638 2071158
## 5 1958 2152546 2051266
## 6 1962 2132466 2034896
## 7 1956 2133588 2029502
## 8 1990 2129495 2028717
## 9 1991 2101518 2009389
## 10 1963 2101632 1996388
## # ℹ 53 more rows
LS0tCnRpdGxlOiAiTGFiIDE6IEludHJvIHRvIFIiCmF1dGhvcjogIkpvYW4gRWdidWNoZSIKZGF0ZTogImByIFN5cy5EYXRlKClgIgpvdXRwdXQ6IG9wZW5pbnRybzo6bGFiX3JlcG9ydAotLS0KCmBgYHtyIGxvYWQtcGFja2FnZXMsIG1lc3NhZ2U9RkFMU0V9CmxpYnJhcnkodGlkeXZlcnNlKQpsaWJyYXJ5KG9wZW5pbnRybykKYGBgCgojIyMgRXhlcmNpc2UgMQpXaGF0IGNvbW1hbmQgd291bGQgeW91IHVzZSB0byBleHRyYWN0IGp1c3QgdGhlIGNvdW50cyBvZiBnaXJscyBiYXB0aXplZD8gCkFOUzogVGhlIGNvbW1hbmQgdXNlZCB0byBleHRyYWN0IGp1c3QgdGhlIGNvdW50cyBvZiBnaXJscyBiYXB0aXplZCBpcyBpbiB0aGUgciBjb2RlIGJlbG93CmBgYHtyIHZpZXctZ2lybHMtY291bnRzfQphcmJ1dGhub3QkZ2lybHMKYGBgCgoKIyMjIEV4ZXJjaXNlIDIKSXMgdGhlcmUgYW4gYXB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