My "rule of thumb" is that any question which requests a code written to the specification, or is a general programming question, will be considered as off-topic. That is because I am trying to avoid questions such as:
"How to calculate STFT in Haskell?".
Even if the OP would get the answer, it presumably won't help other people looking for implementation in different programming languages. We will start getting duplicates of the exact same question in various flavours. What's more, chances of getting a good answer are lower - there are not so many people here that know Haskell. That is why we are trying to make answers language-agnostic, as much as possible. It's better to "teach the man how to fish", and provide him with enough theory and explanation, so he can implement it in any language.
There are obviously some exceptions, and people tend to give examples in languages like: Python, MATLAB, C/C++ and R. That would be the case when problem is simple enough, and program itself can be treated as a "working pseudo-code".
"Why this FIR implementation doesn't work?" (followed by 10's or 100's lines of code)
We are not focusing here on debugging someone's code. Such questions are far way better suited for Stack Overflow. Many DSP SE people have accounts on SO, so that DSP community over there is big enough to help someone.
Your question kind of falls into the first category. You have a specific DSP/Machine Learning problem that you are trying to solve. In order to make it more suitable for DSP SE, you could state the problem differently. More precisely: "How to detect number syllables in audio recordings"? You shouldn't ask explicitly about R implementation. In my opinion, focus first on getting the right algorithm, then it should be a piece of cake to implement it.
Having said that, I don't think that searching for peaks will be robust enough. You would be better of doing some sort of LPC analysis which will give lower dimensionality of your feature vector.