1D File Column Averages

Hey Gurus:

I know you can do this with BASH commands but given this is part of the new way to do cluster correction I figured this might help others so I decided to post it.

I am in the process of doing the new cluster correction procedure.
I have run FWHMx on my subjects’ residuals and gotten out the relevant acf a,b,c parameters.
I have taken these parameters and put them each into their own files which are just 1 column files with 51 (subjects) acf ‘a’ (or ‘b’ or ‘c’) values.

My question: Is there a 1deval tool (or 3dcalc I guess?) that can just take column averages?
I tried setting the 1D file to the variable ‘a’ and using the 3dcalc mean(a) expression but that means across variables so I just get the original file again.

I do know ‘awk’ can do this but if there’s an AFNI command I’m overlooking I’d love to know it and figured others may as well.

Thanks guys!

Hi Lauren,

I would put all values in a single file with a .1D suffix,
e.g. acf_params.1D. If this has 3 columns (one row
per subject), the numbers could be averaged with
3dTstat (using a transpose operator on the input):

3dTstat -prefix - acf_params.1D'

Note that ‘-’ as the prefix means to write to stdout,
unless you prefer a 1D output file.

  • rick

This is perfect, Rick!
Thanks so much for taking the time.