[quote="jl.bobes, post:1, topic:125394"]
index larger than maximal 1771
[/quote
One or both of di[margin]
or dn[[margin]]
is larger than 1771. Hard to say more without a reprex
. See the FAQ: How to do a minimal reproducible example reprex
for beginners