To find the median of a certain column from the command line, first put the path of the file into a
shell variable:
PATH='/path/to/the/table.tab'
specify the column you want to use:
COLUMN=6
and then call the R interpreter from the command line to calculate the median of the wanted column:
MEDIAN=`echo "r=read.table('$PATH');cat(median(r[,$COLUMN]))" | R --slave`
No comments:
Post a Comment