# # Example data-browsing session Tues, 7 Jul 2009 # # dat <- read.table( "T08030205.txt", skip=1 ) # must skip header line because # "Time" not fully labeled summary(dat) # look at column names and # data ranges of each column y <- dat$V7 # V7 is to column Ch1a plot( y ) # plot Y vs 1,2,3,.... on X-axis plot( y, type="l" ) # lines vs points plot( y, type="l", xlim=c( 5000, 10000 ) ) # zoom in plot( y, type="l", xlim=c( 6000, 7000 ) ) # zoom in some more yp <- y - min(y) # move baseline upwards, save in yp plot( yp, type="l", xlim=c(6000,7000) ) # replot n <- length( yp ) sig <- ( yp[1:(n-2)] + yp[2:(n-1)] + yp[3:n] ) / 3 # smooth by averaging each # point with neighbors plot( sig, type="l", xlim=c(6000,7000) ) plot( sig, type="l", xlim=c(6000,6400) ) # try a peak threshold of 20 sig > 20 # boolean vector of positions # that exceed the threshold (1:n)[sig > 20] # actual positions which exceed rug( (1:n)[sig > 20] ) # mark positions with rug # alternative: points( sig * (sig > 20), type="l", col="red" ) # overlay masked signal in red