I need to run an awk script to detect local maxima(peaks) in a spectrum. This spectrum is in the form of two columns in a text file.
This is part of a larger project which will identify whether these peaks represent certain compounds(metabolites really).
I have searched on Google and myriad other places i really cant find anything for running awk scripts in R.
EDIT: The awk script i am using looks something like this-
awk 'BEGIN{dydx = 0;}
{
if(NR > 1)
{ dydx = ($2 - y0)/($1 - x0); }
if(NR > 2 && last * dydx < 0)
{ printf( "%.4f %.4f\n", (x0 + $1)/2, log((dydx<0)?-dydx:dydx)); } ;
last=dydx; x0=$1; y0=$2
}' /home/chaitanya/Work/nmr_spectra/caffeine/pdata/1/spectrumtext.txt | awk '$2 > 17'
You can also see this question i had asked yesterday. Please note it is NOT the same question.