camrinbraun / tags2etuff

An R package for converting the hugely variable formats of animal tag data to a flat file format called eTUFF
Other
2 stars 2 forks source link

interp_pdt() error: grid2loess not functioning correctly #30

Closed jaida-elcock closed 1 year ago

jaida-elcock commented 2 years ago

When running interp_pdt() I got this error:

Error in in (B[1] > min(datasel) & B[1] < max(datasel)){ :    missing value where TRUE/FALSE is needed

This comes from line 216 of grid2dloess as a result of object 'B' being NA at the time it is tested in this IF statement. I think there may be a structural issue in the function causing this to happen as line 198 conducts a try() attempt and assigns it to 'B', which is then assigned to be NA in lines 200-202 if an error results from the try() on line 198. Thus, an NA is passed as 'B' in the if(flagout){ statement on line 215 (and by default this is TRUE), which then yields the aforementioned error. It seems that something needs to be rewritten here to accommodate an NA 'B' being passed to line 216.

basko1 <- read_etuff('159907_2011_110503_eTUFF.txt') pdt <- get_pdt(basko1) head(pdt) PdtTempAvg <- (pdt$PdtTempMax + pdt$PdtTempMin)/2 pdt$PdtTempAvg <- PdtTempAvg head(pdt)

pdt_interp <- interp_pdt(pdt)

camrinbraun commented 1 year ago

I can no longer recreate this issue so it must've been fixed along the way. please re-open if the issue persists.