Mercurial > repos > stevecassidy > wrassp
view util.R @ 3:f188eb0b526d draft
planemo upload commit 2d22bc12c66a3d1949d4bf4c84e7ce7c4610383c-dirty
| author | stevecassidy |
|---|---|
| date | Wed, 14 Dec 2016 21:53:57 -0500 |
| parents | dbcf9bc275e3 |
| children |
line wrap: on
line source
assp_to_tsv <- function(assp, outfile) { # convert to a dataframe, need to add one column at a time result <- data.frame(assp[1]) if (length(attr(assp,'names'))>1) { for(idx in seq(2,length(attr(assp,'names')))) { result <- cbind(result, assp[idx]) } } # add a column of timestamps start <- attr(assp, 'startTime') rate <- attr(assp, 'sampleRate') time <- seq(start, by=1/rate, length.out=nrow(result)) result <- cbind(time, result) write.table(result, file=outfile, sep="\t", quote=F, row.names=F, col.names=T, append=F) }
