source("http://www.openintro.org/stat/data/present.R")
dim (present)
## [1] 63 3
str (present)
## 'data.frame': 63 obs. of 3 variables:
## $ year : num 1940 1941 1942 1943 1944 ...
## $ boys : num 1211684 1289734 1444365 1508959 1435301 ...
## $ girls: num 1148715 1223693 1364631 1427901 1359499 ...
head (present)
names(present)
## [1] "year" "boys" "girls"
present$year
## [1] 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953
## [15] 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967
## [29] 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981
## [43] 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995
## [57] 1996 1997 1998 1999 2000 2001 2002
sum (present$year)
## [1] 124173
sum(present$boys)
## [1] 118792776
sum(present$girls)
## [1] 113016646
# set. 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.
BoysToGirls <- present$boys / (present$boys+present$girls)
plot (present$year,BoysToGirls)
plot (present$year, BoysToGirls, type='l')
#- In what year did we see the most total number of births in the U.S.?
which.max(present$boys+present$girls)
## [1] 22
present[22, c(1)]
## [1] 1961
sum(present [22, c(2,3)])
## [1] 4268326