#Sample Solution
---
title: "Median in R"
output: html_notebook
---
```{r message=FALSE, warning=FALSE}
# load libraries
library(readr)
library(dplyr)
# Load data frame
greatest_books <- read_csv('top-hundred-books.csv')
# Save author ages to author_ages
author_ages <- greatest_books$Ages
# Use R to calculate the median age of the top 100 authors
median_age <- median(author_ages)
print(paste("The median age of the 100 greatest authors, according to a survey by Le Monde is: " , median_age))
```
No comments:
Post a Comment