Quotes help make search much faster. Example: "Practice Makes Perfect"

Thursday, September 5, 2019

Codecademy Aggregates in R Calculating Column Statistics 2/7


#Sample Solution
---
title: "Aggregates in R"
output: html_notebook
---

```{r message = FALSE}
# load packages
library(readr)
library(dplyr)
```

```{r message = FALSE}
# load order data
orders <- read_csv("orders.csv")

# inspect orders here:
head(orders,10)
```

```{r}
# define most_expensive here:
most_expensive <- orders %>% summarize(most_expensive = max(price, na.rm=TRUE))
print(most_expensive)
```

```{r}
# define num_colors here:
num_colors <- orders %>% summarize(num_colors = n_distinct(shoe_color))
#print(num_colors)
#orders %>% distinct(shoe_color) %>% select(shoe_color) %>% arrange(shoe_color)
```

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts