Last active
August 14, 2025 17:24
-
-
Save nylander/a418b571f0953b33c67453f1aa6cc52a to your computer and use it in GitHub Desktop.
Summarize integer values from stdin using R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env Rscript | |
| # File: summary | |
| # Description: Summarize data from stdin as min, max, mean, median | |
| # Requirements: R | |
| # Usage example: for i in $(seq 1 100); do echo $RANDOM; done | summary | |
| # 288 32697 14644.19 14256 | |
| a <- scan(file("stdin"), c(0), quiet=TRUE); | |
| cat(min(a), max(a), mean(a), median(a), "\n"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment