# R wavelets package inverse dwt does not always recover original signal

I recently worked with R's "wavelets" package. I tried the very simple dwt and inverse dwt as follows:

yi = idwt(dwt(y));
plot(y,yi);


where y is a vector. Sometimes y=yi, however, other times, yi does not equal y, they are very different, so that the scatterplot is completely random. This also seems to happen randomly, even with default setting, or following some suggestions, use the option boundary="reflection" . Why is that? The limited documentation says idwt "should" recover the signal. This looks very wrong to me.

Does anyone know a "working" package of wavelet analysis for R?