Awk script in R

前端 未结 3 1884
后悔当初
后悔当初 2020-12-11 12:00

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

相关标签:
3条回答
  • 2020-12-11 12:17

    If you have reasonably smooth spectral data, there are several functions available which do a good job of locating local maxima and minima (aka "peaks"). I like the tools in pastecs , but take a look at the following packages (in my rough order of choice) :

    pastecs,
    Peaks,
    seewave,
    ppc

    0 讨论(0)
  • 2020-12-11 12:37

    Update for Windows 10 users now able to use AWK natively:

    To Windows 10 users with WSL (windows subsystem for linux) installed, you can run AWK in windows from an R console with:

    >  system( 'wsl awk \'BEGIN { print "Hello, world" }\' ')
    Hello, world
    
    0 讨论(0)
  • 2020-12-11 12:40

    you should be able to do

    system('your awk command here')
    

    If you have single quotes in your awk command, either do as Hong Ooi suggests and put your awk command in a separate file and then just run that from the system command or escape the single quotes:

    > system('echo \'hello guy!\' ')
    hello guy!
    
    0 讨论(0)
提交回复
热议问题