#Sample Solution
---
title: "Median in R"
output: html_notebook
---
```{r message=FALSE, warning=FALSE}
# load libraries
library(readr)
library(dplyr)
# Array of the first five author ages
five_author_ages <- c(29, 49, 42, 43, 32)
# Fill in the empty array with the values sorted
sorted_author_ages <- c(29, 32, 42, 43, 49)
# Save the median value to median_value
median_value <- 42
# Print the sorted array and median value
cat("The sorted array is:", sorted_author_ages)
cat(paste("The median of the array is: ", median_value))
```
No comments:
Post a Comment