Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7678251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:36:09+00:00 2026-05-31T17:36:09+00:00

I often find myself with a file that has one number per line. I

  • 0

I often find myself with a file that has one number per line. I end up importing it in excel to view things like median, standard deviation and so forth.

Is there a command line utility in linux to do the same? I usually need to find the average, median, min, max and std deviation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:36:10+00:00Added an answer on May 31, 2026 at 5:36 pm

    This is a breeze with R. For a file that looks like this:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    

    Use this:

    R -q -e "x <- read.csv('nums.txt', header = F); summary(x); sd(x[ , 1])"
    

    To get this:

           V1       
     Min.   : 1.00  
     1st Qu.: 3.25  
     Median : 5.50  
     Mean   : 5.50  
     3rd Qu.: 7.75  
     Max.   :10.00  
    [1] 3.02765
    
    • The -q flag squelches R’s startup licensing and help output
    • The -e flag tells R you’ll be passing an expression from the terminal
    • x is a data.frame – a table, basically. It’s a structure that accommodates multiple vectors/columns of data, which is a little peculiar if you’re just reading in a single vector. This has an impact on which functions you can use.
    • Some functions, like summary(), naturally accommodate data.frames. If x had multiple fields, summary() would provide the above descriptive stats for each.
    • But sd() can only take one vector at a time, which is why I index x for that command (x[ , 1] returns the first column of x). You could use apply(x, MARGIN = 2, FUN = sd) to get the SDs for all columns.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I often find myself wanting to debug CSS layout issues that involve DOM changes
I often find myself needing reference to an object that is several objects away,
I often find myself writing one off queries to either answer someone's question or
I often find myself with a list of disconnected Linq2Sql objects or keys that
I often find myself with fairly complex data that represents something that my objects
I often find myself in the following situation. Say I was editing a file
I often find myself duplicating properties from my EF model classes in my view
I often find myself remembering the name of a class that I want to
I often find myself reading books and articles that outline patterns, best practices, and
I often find myself writing R scripts that generate a lot of output. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.