Thibault Grava wrote:> Hello,
>
> I am working on extracting data from sound recording (fee bee song of the
black-capped chickadee). I obtained a two column matrix with x=time(s) and
y=frequency(khz). The part of the recording that is interesting me is when the
frequency is stable. Does somebody ever used a fonction that extract only
constant data among a huge list of data (sample= 180000)?
I do not quite understand: If the data is constant, why do you want to
extract it in that case?
Anyway, if data is really constant, then try the rle() function which
tells you about the run lengths of constant parts (and you can get end
values by cumsum of the rle output):
x <- c(1,1,1,2,2,2,2,2,1,1)
rle(x)
cumsum(rle(x)$lengths) # end values
Uwe Ligges
> Thanks
>
>
> Thibault Grava
> PhD candidate,
> Natural Resources and Environmental Study (NRES)
> University of Northern BC, Prince George, BC
> phone office: (250) 960 6050
> email address: grava at unbc.ca
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.