Description Usage Arguments Value Author(s) Examples
View source: R/merge_results.R
Merges outputs of two separate slidingwin analyses.
1 | merge_results(dataset1, dataset2)
|
dataset1, dataset2 |
The slidingwin outputs to be merged. Note that all elements (i.e. Dataset, BestModel, BestModelData) will be merged and do not need to be specified. |
A list object, identical to that produced by slidingwin
,
containing all records from both outputs.
Liam D. Bailey and Martijn van de Pol
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #Simple test example
#Create data from a subset of our test dataset
#Just use two years
biol_data <- Mass[1:2, ]
clim_data <- MassClimate[grep(pattern = "1979|1986", x = MassClimate$Date), ]
output <- slidingwin(xvar = list(Temp = clim_data$Temp),
cdate = clim_data$Date,
bdate = biol_data$Date,
baseline = lm(Mass ~ 1, data = biol_data),
range = c(1, 0),
type = "relative", stat = "mean",
func = c("lin"), cmissing = FALSE, cinterval = "day")
#Merge MassOutput
merge_results(output, output)
## Not run:
data(Offspring)
data(OffspringClimate)
# Test a linear functions
OffspringWin_lin <- slidingwin(xvar = list(Temp = OffspringClimate$Temperature),
cdate = OffspringClimate$Date,
bdate = Offspring$Date,
baseline = glm(Offspring ~ 1, data = Offspring, family = poisson),
range = c(150, 0),
type = "relative", stat = "mean",
func = c("lin"), cmissing = FALSE, cinterval = "day")
# Test a quadratic functions
OffspringWin_quad <- slidingwin(xvar = list(Temp = OffspringClimate$Temperature),
cdate = OffspringClimate$Date,
bdate = Offspring$Date,
baseline = glm(Offspring ~ 1, data = Offspring, family = poisson),
range = c(150, 0),
type = "relative", stat = "mean",
func = c("quad"), cmissing = FALSE, cinterval = "day")
# Combine these outputs
OffspringWin_comb <- merge_results(dataset1 = OffspringWin_lin, dataset2 = OffspringWin_quad)
#View analyses contained in the new output
OffspringWin_comb$combos
#View output from linear analysis
head(OffspringWin_comb[[1]]$Dataset)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.