- # HACK for test reports: complete some days with a few NAs, for nicer graphics
- nas_in_serie = is.na(data$getSerie(today))
- if (any(nas_in_serie))
- {
- if (sum(nas_in_serie) >= length(nas_in_serie) / 2)
- return (NA)
- for (i in seq_along(nas_in_serie))
- {
- if (nas_in_serie[i])
- {
- #look left
- left = i-1
- while (left>=1 && nas_in_serie[left])
- left = left-1
- #look right
- right = i+1
- while (right<=length(nas_in_serie) && nas_in_serie[right])
- right = right+1
- #HACK: modify by-reference Data object...
- data$data[[today]]$serie[i] <<-
- if (left==0) data$data[[today]]$serie[right]
- else if (right==0) data$data[[today]]$serie[left]
- else (data$data[[today]]$serie[left] + data$data[[today]]$serie[right]) / 2.
- }
- }
- }
-