library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
tibble(infert)
## # A tibble: 248 × 8
##    education   age parity induced  case spontaneous stratum pooled.stratum
##    <fct>     <dbl>  <dbl>   <dbl> <dbl>       <dbl>   <int>          <dbl>
##  1 0-5yrs       26      6       1     1           2       1              3
##  2 0-5yrs       42      1       1     1           0       2              1
##  3 0-5yrs       39      6       2     1           0       3              4
##  4 0-5yrs       34      4       2     1           0       4              2
##  5 6-11yrs      35      3       1     1           1       5             32
##  6 6-11yrs      36      4       2     1           1       6             36
##  7 6-11yrs      23      1       0     1           0       7              6
##  8 6-11yrs      32      2       0     1           0       8             22
##  9 6-11yrs      21      1       0     1           1       9              5
## 10 6-11yrs      28      2       0     1           0      10             19
## # … with 238 more rows
minors <- infert %>%
  group_by(age)%>%
  summarise(
    count = n(),
    parity = mean(parity, na.rm = TRUE),
    pooled.stratum = mean(pooled.stratum, na.rm = TRUE)
  ) %>%
  filter (age > 30)
minors
## # A tibble: 12 × 4
##      age count parity pooled.stratum
##    <dbl> <int>  <dbl>          <dbl>
##  1    31    21   1.43           38.7
##  2    32    15   1.4            29.2
##  3    34    18   2.33           30.2
##  4    35    18   2              33.2
##  5    36    15   2.6            35.4
##  6    37    12   2.5            42.2
##  7    38     8   3.38           48  
##  8    39     9   3.33           16.7
##  9    40     6   1.5            20.5
## 10    41     3   1              15  
## 11    42     6   1               8.5
## 12    44     3   1              17
library(ggplot2)
#create a bar chart
#add some labels to the graph
ggplot(data=minors, aes(x=age, y=count, fill = age))+
  geom_bar(colour= "black", fill= "#FFFF33", stat = "identity")+
  guides(fill= FALSE)+
  xlab("Growing age")+
  ylab("parity and pooled stratum")+
  ggtitle("Correlation between age and count")
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.

#now we create a line graph

ggplot(data=minors, aes(x =age, y=count, group = 1))+
  geom_line(colour= "red", linetype ="dashed", size= 1.5)+
  geom_point(colour= "black", size=4, shape=21, fill="white")+
  ggtitle("line graph number one")
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.

install.packages(“curl”)