R/rseis2ts.R

Defines functions rseis2ts

Documented in rseis2ts

rseis2ts<-function(GH, sel=1, notes='')
    {
### this function converts one trace from a n RSEIS
### list to a ts object in R
###   useful for giving a single trace to someone
        
        if(length(sel)>1) sel = sel[1]

        if(!is.numeric(sel) ) {
            cat('sel must be an index to GH\n')
            return(NULL)
        }
### A is a time series; attribute info is a list
        
        A = ts(GH$JSTR[[sel]], deltat = GH$dt[sel])
        info = as.list( data.frame( GH$info )[sel, ] )
        info$stn = GH$STNS[sel]
        info$comp = GH$COMPS[sel]
        info$notes = notes
        
        attr(A, 'info') <- info

       return(A)
    }

Try the RSEIS package in your browser

Any scripts or data that you put into this service are public.

RSEIS documentation built on Sept. 13, 2024, 1:09 a.m.