Thread View: alt.lang.awk
1 messages
1 total messages
Started by ydziO
Mon, 22 Jul 2019 16:07
Re: calculate variance of column
Author: ydziO
Date: Mon, 22 Jul 2019 16:07
Date: Mon, 22 Jul 2019 16:07
25 lines
1389 bytes
1389 bytes
<voodoo.bender@gmail.com> wrote:
> Hi,
> I'm trying to elabotare a script to calulate variance of column of values skip first row
>
> awk 'NR>1''{ s += $2 } END { print "sum: ", s, " average: ",), "
> variance: ", 1 / ((NR-1) - 1) * sum($2- s/(NR-1))^2, " samples: ", (NR-1) }'
>
> I obtain error
> fatal: `sum 'function not defined
>
> regards
>
> Al
>
Here: is error
sum($2- s/(NR-1)
If you want sum so You have to do like this
s/(NR-1)
replace divide by this "+" -without quotation marks
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads