## # A tibble: 82 x 3
## year boys girls
## <int> <int> <int>
## 1 1629 5218 4683
## 2 1630 4858 4457
## 3 1631 4422 4102
## 4 1632 4994 4590
## 5 1633 5158 4839
## 6 1634 5035 4820
## 7 1635 5106 4928
## 8 1636 4917 4605
## 9 1637 4703 4457
## 10 1638 5359 4952
## # ... with 72 more rows
## Rows: 82
## Columns: 3
## $ year <int> 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1...
## $ boys <int> 5218, 4858, 4422, 4994, 5158, 5035, 5106, 4917, 4703, 5359, 5...
## $ girls <int> 4683, 4457, 4102, 4590, 4839, 4820, 4928, 4605, 4457, 4952, 4...
## [1] 5218 4858 4422 4994 5158 5035 5106 4917 4703 5359 5366 5518 5470 5460 4793
## [16] 4107 4047 3768 3796 3363 3079 2890 3231 3220 3196 3441 3655 3668 3396 3157
## [31] 3209 3724 4748 5216 5411 6041 5114 4678 5616 6073 6506 6278 6449 6443 6073
## [46] 6113 6058 6552 6423 6568 6247 6548 6822 6909 7577 7575 7484 7575 7737 7487
## [61] 7604 7909 7662 7602 7676 6985 7263 7632 8062 8426 7911 7578 8102 8031 7765
## [76] 6113 8366 7952 8379 8239 7840 7640
## [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
Insert any text he re. Yes, there is an apparent trend in the number of girls baptized over the years. From year 1629 (bearing that there was a decrease number of girls from 1640 to 1660), there was an increase number of girls all the way to year 1710.This can be observed by a linear regression plot or
# Insert code for Exercise 2 here
ggplot(data = arbuthnot, aes(x = year, y = girls)) +
geom_point() + geom_smooth(method = "lm")
## `geom_smooth()` using formula 'y ~ x'
## [1] 9901
## [1] 9901 9315 8524 9584 9997 9855 10034 9522 9160 10311 10150 10850
## [13] 10670 10370 9410 8104 7966 7163 7332 6544 5825 5612 6071 6128
## [25] 6155 6620 7004 7050 6685 6170 5990 6971 8855 10019 10292 11722
## [37] 9972 8997 10938 11633 12335 11997 12510 12563 11895 11851 11775 12399
## [49] 12626 12601 12288 12847 13355 13653 14735 14702 14730 14694 14951 14588
## [61] 14771 15211 15054 14918 15159 13632 13976 14861 15829 16052 15363 14639
## [73] 15616 15687 15448 11851 16145 15369 16066 15862 15220 14928
## # A tibble: 82 x 4
## year boys girls total
## <int> <int> <int> <int>
## 1 1629 5218 4683 9901
## 2 1630 4858 4457 9315
## 3 1631 4422 4102 8524
## 4 1632 4994 4590 9584
## 5 1633 5158 4839 9997
## 6 1634 5035 4820 9855
## 7 1635 5106 4928 10034
## 8 1636 4917 4605 9522
## 9 1637 4703 4457 9160
## 10 1638 5359 4952 10311
## # ... with 72 more rows
## [1] 1.114243
## [1] 0.5270175
Insert any text here.
I see a decline (a downward trend ) of the proportion of newborn that are boys from year to year .
# Insert code for Exercise 3 here
ggplot(data = arbuthnot, aes(x = year, y = boy_ratio)) +
geom_line() + geom_smooth(method = "lm")
## `geom_smooth()` using formula 'y ~ x'
Insert any text here.
For the minimum amount of boy births, year = 1650 For the maximum amount of boy births, year = 1698
The dimensions of the data frame are 1 row and 02 columns The variable = min, max
## # A tibble: 1 x 2
## min max
## <int> <int>
## 1 2890 8426
## # A tibble: 82 x 6
## year boys girls total boy_to_girl_ratio boy_ratio
## <int> <int> <int> <int> <dbl> <dbl>
## 1 1629 5218 4683 9901 1.11 0.527
## 2 1630 4858 4457 9315 1.09 0.522
## 3 1631 4422 4102 8524 1.08 0.519
## 4 1632 4994 4590 9584 1.09 0.521
## 5 1633 5158 4839 9997 1.07 0.516
## 6 1634 5035 4820 9855 1.04 0.511
## 7 1635 5106 4928 10034 1.04 0.509
## 8 1636 4917 4605 9522 1.07 0.516
## 9 1637 4703 4457 9160 1.06 0.513
## 10 1638 5359 4952 10311 1.08 0.520
## # ... with 72 more rows
## [1] 5218
#arbuthnot[which.min(arbuthnot$boys), ] , this pull the row of the minimum amount of boys births
#arbuthnot[which.max(arbuthnot$boys), ] , this pull the row of the maximum amount of boys births
# questions: from arbuthnot, there should be a way to narrow the matching value for a specific value in one column with another column or row value for column year and boys ...Like what is the year for which boys births amount was 8426(not necessary the max)? answer is 1698
#How to nested search index -->another example: Like what is the year for which boys births amount was 5218 ? answer is 1629
#how to nest search index --> another example: in year 1629, how many boys and girls were born? answer are boys = 5218, girs = 4683
Insert any text here.
How do these counts compare to Arbuthnot’s? Are they of a similar magnitude? I am not sure I understand this question well. the magnitude of the data for max and min is still the same since the summarize call only does a search index for a particular value within a column. Here the magnitude is in the 1K. Otherwise I will be happy to a get a better understanding of the question if you can provide more explanation.
Insert any text here.
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
I don’t know if there is the typo on the question above. Because I answered thi question in exercise 03, perhaps you were asking for the display proportion of girl. In this case, there is a upward trend for girls from year to year…kind of opposite to boy
# Insert code for Exercise 6 here
arbuthnot <- arbuthnot %>%
mutate(girl_ratio = girls / total) # creating a column for girls ratio in arbuthnot
ggplot(data = arbuthnot, aes(x = year, y = girl_ratio)) +
geom_line() + geom_smooth(method = "lm") # creating a plot that display the proportion of boys born over time.
## `geom_smooth()` using formula 'y ~ x'
Insert any text here.
The year for the most total number of birth is 1705 Now, I don’t know if I missed a U.S dataset somewhere in this lab because you keep referring to U.S instead of London, England. I am a bit confused.
## # A tibble: 82 x 7
## year boys girls total boy_to_girl_ratio boy_ratio girl_ratio
## <int> <int> <int> <int> <dbl> <dbl> <dbl>
## 1 1629 5218 4683 9901 1.11 0.527 0.473
## 2 1630 4858 4457 9315 1.09 0.522 0.478
## 3 1631 4422 4102 8524 1.08 0.519 0.481
## 4 1632 4994 4590 9584 1.09 0.521 0.479
## 5 1633 5158 4839 9997 1.07 0.516 0.484
## 6 1634 5035 4820 9855 1.04 0.511 0.489
## 7 1635 5106 4928 10034 1.04 0.509 0.491
## 8 1636 4917 4605 9522 1.07 0.516 0.484
## 9 1637 4703 4457 9160 1.06 0.513 0.487
## 10 1638 5359 4952 10311 1.08 0.520 0.480
## # ... with 72 more rows
## # A tibble: 1 x 7
## year boys girls total boy_to_girl_ratio boy_ratio girl_ratio
## <int> <int> <int> <int> <dbl> <dbl> <dbl>
## 1 1705 8366 7779 16145 1.08 0.518 0.482