dathomog | R Documentation |
Homogenizes daily data from two data sets into one data set; optionally show cross-plots to examine how well correlated that data sets are.
dathomog(x1, x2, by = "date", plot = FALSE)
x1 |
a |
x2 |
a |
by |
name of common column, usually ‘date’, which is of
class |
plot |
|
Data from x1
has priority over x2
. Where data from
x1
is either NA
or missing (outside of time range), data
from x2
will be used (if available). Otherwise data form
x1
will be used directly. Variables will be
homogenized where their names are identical, found using
names
.
The cross-plots of the data are shown only for interest. They show
useful correlation statistics, and a best-fit line using perpendicular
offsets (which are preferred in this case over traditional linear
regression). At some point, the equations for this line may be used to
adjust the values from x2
, however this can always be done
externally to this function by pre-processing x2
.
Returns a data.frame
of seasonal data required by most functions
in seas. Variable names of the structure are found by a
union
of the names of x1
and x2
.
Weather stations should be sufficiently close enough to approximate the same weather. This distance depends on the spatial distance and local climatology.
Mike Toews
http://mathworld.wolfram.com/LeastSquaresFittingPerpendicularOffsets.html
data(mscdata) dat1 <- mksub(mscdata, id=2100630) dat2 <- mksub(mscdata, id=1108447) year.plot(dat1) year.plot(dat2) newdata <- dathomog(dat1, dat2) year.plot(newdata) message(paste(c("This is a rather poor example, since the", "two stations are nowhere near each other"), collapse="\n"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.