Rscript -e 'x <- rnorm(1000, mean=50, sd=10); print(summary(x))'

Category: Data Science & Analysis

Rscript -e 'x <- rnorm(1000, mean=50, sd=10); print(summary(x))'

Generate 1000 normal samples and summarize them

rnorm() draws random numbers from a normal distribution, here 1000 samples with mean 50 and standard deviation 10. summary() then reports its min, quartiles, mean, and max. The sample mean and median should land near 50 for a large draw. Set a seed with set.seed(42) first to make the random draw reproducible.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.