Eleutherodactylus Research Course · Fall 2026
2026-10-14

EID@eid.utexas.edu in the email box, using your own EID in lowercase. Don’t click Google or Apple.It’s free for UT students and separate from any personal Claude account.
Error in seq.default(...) : wrong sign in 'by' argument
✗ Weak prompt
my R code gives this error, fix it
Claude has to guess. A likely guess is that your start and end times are swapped, and it may rewrite your chunk.
Your times aren’t swapped, so you lose 20 minutes checking them.
✓ Better prompt
I'm rendering a Quarto notebook in RStudio (R 4.5.3, seewave, tuneR).
This chunk fails at Step 4:
dom_freq_khz <- function(piece) {
spec <- meanspec(piece, wl = 512, plot = FALSE)
...
}
Error: seq.default: wrong sign in 'by' argument
It works for most calls but fails for some. My shortest calls are
about 10 ms long at 44.1 kHz.
I'm learning R, so teach me how to debug this rather than handing
me the fix. Explain what the error means, then give me a hint or a
question that points me to the cause. Let me try a fix myself, and
check my reasoning before you show me yours.
Claude asks: How many samples are in a 10 ms call at 44.1 kHz? To answer, you need two terms.
Sampling rate. A recorder doesn’t store a smooth wave. It measures the sound pressure over and over, and each measurement is a sample. At 44.1 kHz it takes 44,100 samples every second.
A 10 ms call lasts 0.010 s, so it holds 0.010 × 44,100 = 441 samples.
Window length (wl). To find a call’s frequencies, meanspec() cuts the sound into chunks called windows, analyzes each one, and averages them. wl = 512 makes every window 512 samples long, which is 11.6 ms at 44.1 kHz.
Call: 441 samples Window: 512 samples
The window is longer than the call, so it can’t fit even once. meanspec() then asks seq() to count from a start point to an end point that comes before it, and seq() throws the error.
The window has to fit inside the call. Use the largest power of 2 (128, 256, 512, …) that fits, because the math inside meanspec() runs fastest on those sizes.
Read it from the inside out, for a 441-sample call:
length(piece@left) is 441, the number of samples in the call (@left is the recording’s left channel)log2(441) is 8.78, because 28.78 = 441floor(8.78) rounds down to 8, so the window will fit2^8 is 256, a window shorter than the callmin(512, 256) is 256. Long calls still get 512; only short ones get a smaller windowThe cost: a smaller window gives coarser frequencies. Each step in the spectrum is the sampling rate divided by wl, so 44,100 / 512 ≈ 86 Hz but 44,100 / 256 ≈ 172 Hz. Check that’s precise enough for what you measure.
?function before you trust themPrepared with Claude Code (Claude Opus 5.5, Anthropic): slides and first draft.
ut-fri-biodiversity.github.io/eleuth-calls