This function operates in two ways, depending on the number of data points. If x
and y
have two non-NA
observations, percentage change is calculated using the first and last values. If three or more points are
available, a linear regression is used to estimate the average percentage change. If fewer than two points
are available, the percentage change cannot be estimated and NA
is returned.
If all y
values are equal, it will return a change of zero.