veri setini inceleme işlemi
glimpse
fonksiyonu ile
yapılabilir
## Rows: 82
## Columns: 3
## $ year <int> 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639…
## $ boys <int> 5218, 4858, 4422, 4994, 5158, 5035, 5106, 4917, 4703, 5359, 5366…
## $ girls <int> 4683, 4457, 4102, 4590, 4839, 4820, 4928, 4605, 4457, 4952, 4784…
veri setindeki kız sayıları
## [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
kızların değişim trendi…………
ggplot(data = arbuthnot, aes(x = year, y = girls)) +
geom_line() +
theme_bw() +
labs (x = "kiz sayisi",
y= "yillar")
toplam sayı
## [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
mutate
fonksiyonu ile yeni değişken ekleme
erkek kız oranı ekleme
Insert any text here.
erkeklerin kızlardan fazla olması
arbuthnot <- arbuthnot %>%
mutate(more_boys = boys > girls)
arbuthnot <- arbuthnot %>%
mutate(more_boys_numeric = as.numeric(boys > girls))
betimsel istatistik
## # A tibble: 1 × 2
## minimum maximum
## <int> <int>
## 1 2890 8426
What years are included in this data set? What are the dimensions of the data frame? What are the variable (column) names?
## [1] 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643
## [16] 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658
## [31] 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673
## [46] 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688
## [61] 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703
## [76] 1704 1705 1706 1707 1708 1709 1710
## [1] 82 7
## [1] 82
## [1] 7
colnames(arbuthnot) <-
c("yil", "erkek", "kiz", "toplam", "erkek/kiz", "cok_erkek",
"cok_erkek_sayisal")
#relocate
arbuthnot_v2 <- arbuthnot %>% select (1:3,7,6,5)
How do these counts compare to Arbuthnot’s? Are they of a similar magnitude? yapacak bir şey yok
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. Hint: You should be able to reuse your code from Exercise 3 above, just replace the name of the data frame.
Insert any text here.
In what year did we see the most total number of births in the U.S.? Hint: First calculate the totals and save it as a new variable. Then, sort your dataset in descending order based on the total column. You can do this interactively in the data viewer by clicking on the arrows next to the variable names. To include the sorted result in your report you will need to use two new functions. First we use arrange() to sorting the variable. Then we can arrange the data in a descending order with another function, desc(), for descending order. The sample code is provided below.
### Exercise 7
Insert any text here.
``` r
arbuthnot %>% arrange(desc(toplam))
## # A tibble: 82 × 7
## yil erkek kiz toplam `erkek/kiz` cok_erkek cok_erkek_sayisal
## <int> <int> <int> <int> <dbl> <lgl> <dbl>
## 1 1705 8366 7779 16145 1.08 TRUE 1
## 2 1707 8379 7687 16066 1.09 TRUE 1
## 3 1698 8426 7626 16052 1.10 TRUE 1
## 4 1708 8239 7623 15862 1.08 TRUE 1
## 5 1697 8062 7767 15829 1.04 TRUE 1
## 6 1702 8031 7656 15687 1.05 TRUE 1
## 7 1701 8102 7514 15616 1.08 TRUE 1
## 8 1703 7765 7683 15448 1.01 TRUE 1
## 9 1706 7952 7417 15369 1.07 TRUE 1
## 10 1699 7911 7452 15363 1.06 TRUE 1
## # ℹ 72 more rows