HW Exercise 0316-4
The usBirths2015.txt is a dataset of monthly births in the US in 2015. Summarize the number of births by season.
Loading and checking the dataset
dta <- read.table("C:/Users/USER/Desktop/R_data management/0316/usBirths2015.txt", header = T)
head(dta)## birth month
## 1 325955 January
## 2 298058 February
## 3 328923 March
## 4 320832 April
## 5 327917 May
## 6 330541 June
Creating new variable
## birth month season
## 1 325955 January spring
## 2 298058 February spring
## 3 328923 March spring
## 4 320832 April summer
## 5 327917 May summer
## 6 330541 June summer
## 7 353415 July fall
## 8 351791 August fall
## 9 347516 September fall
## 10 339007 October winter
## 11 318820 November winter
## 12 335722 December winter
Summarizing the number of births by season
## season birth
## 1 fall 350907.3
## 2 spring 317645.3
## 3 summer 326430.0
## 4 winter 331183.0