# Sampling in R

Want to learn more? I recommend working through: R for Data Science, R Cookbook, and R Graphics Cookbook.

```# Create a population of data
population <- rnorm(1000)
```
```# Sample 100 observation from the population of data, without replacement
sample <- sample(population, 100, replace = FALSE)
```
```# View the sample
sample
```
```  [1] -0.129219040  1.518986856 -1.121348640 -1.150077471 -0.489263654
[6] -0.841177103 -0.774176234  0.070402146 -0.109056603 -1.648204067
[11]  0.998132544 -0.249399062  0.792774951  0.497899767  0.779363069
[16]  1.343803830 -0.260186522  1.121706668 -1.458195137  1.603245141
[21]  0.424563292 -2.208635666  1.433034664 -1.087884969  0.505870371
[26]  1.139785998 -0.825174901  0.604944521  0.482636039  0.329966134
[31] -0.356832455  0.202305723 -1.269608482 -1.876274254 -1.568588222
[36]  1.027197383  0.569795152  0.394942749 -0.059843038  1.051632852
[41] -0.761036116 -1.177838442 -0.252533986  0.447810962 -1.377854032
[46] -0.563699314 -0.376471704  0.097157070  0.821499638 -0.274195994
[51]  0.640105046 -1.177857754  1.021021671  0.723894247 -0.557805790
[56]  2.313566185  0.070609946 -0.941583920 -0.851167218 -1.113739717
[61]  0.738163098 -0.274254246  1.052859723 -0.691817242 -0.003154583
[66]  0.039907038  0.301564691 -1.773501450 -0.207059604  0.059896893
[71] -0.478809890  0.305387446  0.154420143 -1.398018312 -0.748575560
[76]  0.772815759  0.398396468  0.478987088 -0.677324774 -0.422754198
[81]  0.064750414 -0.813921740  1.220945535  0.054736122 -1.230677889
[86] -1.105874754 -0.705068905 -0.496520306  1.332298141  1.246263878
[91] -0.020308835 -1.801665946 -0.607985694 -1.138447356 -0.375253558
[96]  0.787363533 -1.925421450 -1.608369372  0.187454701  1.008443172
```