Go Down

Topic: Calculating Median, etc on Yun (Read 847 times)previous topic - next topic

TrashCompactor

Jan 24, 2017, 11:09 pm
Hey all,

I'm interested in calculating some basic stats from a list of numbers saved to a file on the SD card.  I've been searching for how to calculate the median from a shell script since that is one of the harder stats because it requires sorting the numbers first.  I found this discussion but I'm not sure if the answers will work on the limited resources the Yun has:

http://unix.stackexchange.com/questions/13731/is-there-a-way-to-get-the-min-max-median-and-average-of-a-list-of-numbers-in

I'm really interested in try to get the R programming language to work on the Linux side of the Yun if possible since that would have benefits in other projects and upgrades.  I'm just not sure if R can be installed on the Yun and was hoping the community might know.  It looks like it can be installed on the Raspberry Pi (I know, more resources).

If that's a dead end though I would be interested if anyone does any calculations of stats (mean, median, min, max, standard deviation, etc) on the Linux side of their Yun.  I don't have much room left in my program memory to do it within the arduino sketch.

Thanks in advance for any ideas!

Summary
1) will R work on the Yun
2) has anyone calculated stats on the Linux side of the Yun and how

ebstauffer

#1
Jan 25, 2017, 01:41 am
You can do it in PHP in about 12 lines of code. Get our your google fu

Coupled with Process and you could do it very simply

TrashCompactor

#2
Jan 25, 2017, 06:10 pm
You can do it in PHP in about 12 lines of code. Get our your google fu
Thanks for the response.  Why PHP over other language choices?  I'm using this upgrade to my code as an excuse to learn a new language potentially.  PHP could be it

I could see calculating the median in a few lines of code but the difficult part about calculating the median is that the list must be sorted first.  There are different methods for sorting but they take a relatively high amount of the resources available to these small processors (memory and time mostly).

Thx

ebstauffer

#3
Jan 25, 2017, 10:20 pm
Only because I've been writing in PHP for nearly 20 years. Clearly you could do it in python. I just dont have it in my to learn another language.  Also, the linux side of the Yun is a really powerful compute platform.  How many numbers are in the set for which you want to calculate the median?

Go Up