I’m receiving an error that seems rather simplistic so I’m hoping you all can fix it quickly. It looks like an Rbind error upon combining all results as part of the makeDisplay() function.
Below is my code and the error R spits out. I found a hint in the following stackoverflow question, but don’t believe there is anything I can do on my side to overcome this error. Let me know if you need more information or how I can help clarify. I downloaded
the latest datadr and trelliscope versions just now, but that didn’t change the outcome/error. I was able to create other displays with this data (though it was divided differently). Also I was able to use kvApply on each subset (all 188 subsets) for both
the panel function and the cognostic function to assure myself that it wasn’t just something in the data. Thanks,
byMissionVar = divide(ddf(melt(d, id.vars = c("Mission", "Year", "Month", "dt"))),
by = c("Mission", "variable"))
pf1.byMissionVar = function(x) {
mission = getSplitVars(x)$Mission
var = getSplitVars(x)$variable
ggplot(data = melt(x, id.vars = c("Year", "Month", "dt")),
aes(x = dt, y = value)) +
geom_line() +
geom_smooth(method = "loess") +
theme_bw() +
labs(x = "", y = var, title = mission) +
theme(legend.position = "none")
}
kvApply(byMissionVar[[1]], pf1.byMissionVar)
cf1.byMissionVar = function(x) {
x = x[order(x$Year, x$Month),]
x$index = 1:nrow(x)
if(any(x$Year > 2012)) {
slopeAll = coef(lm(value ~ index, x))[2]
slope2013 = coef(lm(value ~ index, x[x$Year > 2012,]))[2]
} else {
slopeAll = NA
slope2013 = NA
}
list(
cog(slopeAll, desc = "slope", type = "numeric"),
cog(slope2013, desc = "slopeOnly2013toPresent", type = "numeric"),
cogMean(x$value),
cogMean(x$value[x$Year == 2011], desc = "mean2011"),
cogMean(x$value[x$Year == 2012], desc = "mean2012"),
cogMean(x$value[x$Year == 2013], desc = "mean2013"),
cogMean(x$value[x$Year == 2014], desc = "mean2014"),
cogMean(x$value[x$Year == 2015], desc = "mean2015"),
cog(mean(x$value[x$Year == 2015], na.rm = T) - mean(x$value[x$Year == 2014], na.rm = T),
desc = "2015-2014"),
cog(mean(x$value[x$Year == 2014], na.rm = T) - mean(x$value[x$Year == 2013], na.rm = T),
desc = "2014-2013")
)
}
kvApply(byMissionVar[[1]], cf1.byMissionVar)
makeDisplay(byMissionVar, "byMissionVar", height = 400, width = 600, panelFn = pf1.byMissionVar, cogFn = cf1.byMissionVar)
* Validating 'panelFn'...
* Testing cognostics function on a subset ... ok
* Precomputed limits not supplied. Computing axis limits...
* ... skipping this step since both axes are free ...
Error in match.names(clabs, names(xi)) :
names do not match previous names