标签:
findpeak<-function(x){
peak<-NULL
peak1<-NULL
if (x[1]>=x[length(x)]){
peak1<-1
}else{
peak1<-0
}
for (i in 2:length(x)){
if (x[i]>=x[i-1]) {
peak<-c(peak,1)
}else{
peak<-c(peak,0)
}
}
return(c(peak1,peak))
}
标签:
原文地址:http://www.cnblogs.com/xiongchang18/p/4791668.html