Awk script in R -
Awk script in R -
i need run awk script observe local maxima(peaks) in spectrum. spectrum in form of 2 columns in text file.
this part of larger project identify whether these peaks represent compounds(metabolites really).
i have searched on google , myriad other places cant find running awk scripts in r.
edit: awk script using looks this-
awk 'begin{dydx = 0;} { if(nr > 1) { dydx = ($2 - y0)/($1 - x0); } if(nr > 2 && lastly * 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 see this question had asked yesterday. please note not same question.
you should able do
system('your awk command here')
if have single quotes in awk
command, either hong ooi suggests , set awk
command in separate file , run system
command or escape single quotes:
> system('echo \'hello guy!\' ') hello guy!
r awk
Comments
Post a Comment