library(NHANES)
library(ggplot2)
NHANES <- NHANES

ggplot(NHANES, aes(Age, BMI)) +
  geom_point()
## Warning: Removed 366 rows containing missing values (geom_point).

ggplot(NHANES, aes(Age, BMI)) +
  geom_point((aes(colour = Gender)))+
  labs(title = "BMI given Age ") +
  theme(plot.title = element_text(hjust = .5)) +
  labs( x ="Age in Years") +
  labs( y = "Body Mass Index")
## Warning: Removed 366 rows containing missing values (geom_point).

ggplot(NHANES, aes(Age, BMI)) +
  geom_point()+
  geom_smooth() +
  facet_grid(Gender ~ Education) +
  labs(title = "BMI given Age faceted by Education and Gender ") +
  theme(plot.title = element_text(hjust = .5)) +
  labs( x ="Age in Years") +
  labs( y = "Body Mass Index")
## `geom_smooth()` using method = 'gam'
## Warning: Removed 366 rows containing non-finite values (stat_smooth).

## Warning: Removed 366 rows containing missing values (geom_point).