Skip to content

Instantly share code, notes, and snippets.

@pokle
Created October 24, 2012 06:41
Show Gist options
  • Save pokle/3944417 to your computer and use it in GitHub Desktop.
Save pokle/3944417 to your computer and use it in GitHub Desktop.
Work out the mean (average), min, max, median and quartiles of number in a plain text file using R
cat > data.csv <<HERE
4
5
6
7.9
HERE
r --slave -e 'summary(scan(file="data.csv"))'
## Results in:
# Read 4 items
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 4.000 4.750 5.500 5.725 6.475 7.900
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment