On the second page of the Stratified Sampling and Cluster Sampling lesson, we are told that if we use sample_n(wnba, size = 10) and then calculate the mean of the PTS column in that sample, we will get the same result as when we calculate the mean of sample(wnba$PTS, size = 10). The lesson says that the mean in both cases will be 206.5.

However, I tried this in the console (with the code below) and I get two different results. I was also getting different results when learning about set.seed() in the previous lesson, so I’m very curious about this. Could someone explain if I’ve done something wrong here? Or is the lesson incorrect and the sample() or sample_n() functions will return different results?

Screen Link:

https://app.dataquest.io/c/70/m/394/stratified-sampling-and-cluster-sampling/2/sampling-rows

My Code:

```
library(dplyr)
set.seed(1)
wnba_sampled <- sample_n(wnba, size = 10)
mean1 <- mean(wnba_sampled$PTS)
pts_sampled <- sample(wnba$PTS, size = 10)
mean2 <- mean(pst_sampled)
```

```
Result:
mean1
numeric (double)
[1] 171.4
mean2
numeric (double)
[1] 195.6
```