Package: xtable
Version: 1.8-3
-Date: 2016-03-04
+Date: 2016-03-30
Title: Export Tables to LaTeX or HTML
Author: David B. Dahl <dahl@stat.byu.edu>
Maintainer: David Scott <d.scott@auckland.ac.nz>
1.8-3 (NOT YET SUBMITTED TO CRAN)
* Corrected call to print.xtable inside print.xtableFtable included
arguments from call to print.xtableFtable. Absence of size
- argumnet was advised by Lluis Ramon, email March 4, 2016
+ argument was advised by Lluis Ramon, email March 4, 2016
+ * Added patch from Martin Gubri, martin.gubri@framasoft.org to
+ enable use of lagImpactMat from spdep in xtable method lagImpact.
+ * Added patch to code in OtherPackagesGallery.Rnw supplied by Martin
+ Gubri to avoid warnings in the spdep package example. Also fixed the
+ vignette index entry.
1.8-2 (2016-02-05)
* Added function print.xtableMatharray to enable easy creation of
+++ /dev/null
-### This function is a copy of spdep:::lagImpactMat
-### It has been copied because lagImpactMat is not exported by spdep
-### There is no help available for lagImpactMat in spdep,
-### so I have not provided any help, and I am unable to trace the author
-###
-lagImpactMat <- function (x, reportQ = NULL)
-{
- if (is.null(x$res)) {
- direct <- x$direct
- indirect <- x$indirect
- total <- x$total
- } else {
- direct <- x$res$direct
- indirect <- x$res$indirect
- total <- x$res$total
- }
- mat <- cbind(direct, indirect, total)
- colnames(mat) <- c("Direct", "Indirect", "Total")
- rownames(mat) <- attr(x, "bnames")
- if (!is.null(reportQ) && reportQ) {
- if (is.null(x$res)) {
- Qobj <- attr(x, "Qres")
- } else {
- Qobj <- attr(x$res, "Qres")
- }
- if (is.null(Qobj)) {
- warning("No impact components to report")
- } else {
- if (length(attr(x, "bnames")) == 1L) {
- Qobj$direct <- matrix(Qobj$direct, ncol = 1)
- Qobj$indirect <- matrix(Qobj$indirect, ncol = 1)
- Qobj$total <- matrix(Qobj$total, ncol = 1)
- }
- colnames(Qobj$direct) <- attr(x, "bnames")
- colnames(Qobj$indirect) <- attr(x, "bnames")
- colnames(Qobj$total) <- attr(x, "bnames")
- rownames(Qobj$direct) <- paste0("Q", 1:nrow(Qobj$direct))
- rownames(Qobj$indirect) <- paste0("Q", 1:nrow(Qobj$indirect))
- rownames(Qobj$total) <- paste0("Q", 1:nrow(Qobj$total))
- attr(mat, "Qobj") <- Qobj
- }
- }
- mat
-}
display = display, auto = auto, ...))
}
-
-### This method removed because of the need to copy code to pass CRAN checks
-### lagImpactMat is neither exported nor documented in spdep
-
-###lagImpact objects
+### lagImpact objects
xtable.lagImpact <- function(x, caption = NULL, label = NULL, align = NULL,
digits = NULL, display = NULL,
auto = FALSE, ...) {
+ requireNamespace('spdep')
+ lagImpactMat <- get('lagImpactMat', environment(spdep::spdep))
xtable(lagImpactMat(x), caption = caption, label = label,
align = align, digits = digits,
display = display, auto = auto, ...)
\name{xtable-internal}\r
\alias{xtableLSMeans}\r
-\alias{lagImpactMat}\r
+\r
\r
\title{Internal xtable Functions}\r
\description{\r
\alias{xtable.stsls}
\alias{xtable.summary.stsls}
\alias{xtable.sarlm.pred}
-%%%\alias{xtable.lagImpact}
+\alias{xtable.lagImpact}
\alias{xtable.splm}
\alias{xtable.summary.splm}
\alias{xtable.sphet}
-%\VignetteIndexEntry{xtable List of Tables Gallery}\r
+%\VignetteIndexEntry{xtable Other Packages Gallery}\r
%\VignetteDepends{xtable, spdep, splm, sphet}\r
%\VignetteKeywords{LaTeX, HTML, table}\r
%\VignettePackage{xtable}\r
<<dataspdep>>=\r
library(spdep)\r
data("oldcol", package = "spdep")\r
-COL.lag.eig <- lagsarlm(CRIME ~ INC + HOVAL, data = COL.OLD[],\r
- nb2listw(COL.nb))\r
+\r
+data.in.sample <- COL.OLD[1:44,]\r
+data.out.of.sample <- COL.OLD[45:49,]\r
+\r
+listw.in.sample <- nb2listw(subset(COL.nb, !(1:49 %in% 45:49)))\r
+listw.all.sample <- nb2listw(COL.nb)\r
+\r
+COL.lag.eig <- lagsarlm(CRIME ~ INC + HOVAL, data = data.in.sample,\r
+ listw.in.sample)\r
class(COL.lag.eig)\r
-COL.errW.GM <- GMerrorsar(CRIME ~ INC + HOVAL, data = COL.OLD,\r
- nb2listw(COL.nb, style = "W"),\r
- returnHcov = TRUE)\r
+COL.errW.GM <- GMerrorsar(CRIME ~ INC + HOVAL, data = data.in.sample,\r
+ listw.in.sample, returnHcov = TRUE)\r
class(COL.errW.GM)\r
-COL.lag.stsls <- stsls(CRIME ~ INC + HOVAL, data = COL.OLD,\r
- nb2listw(COL.nb))\r
+COL.lag.stsls <- stsls(CRIME ~ INC + HOVAL, data = data.in.sample,\r
+ listw.in.sample)\r
class(COL.lag.stsls)\r
\r
-p1 <- predict(COL.lag.eig, newdata = COL.OLD[45:49,],\r
- listw = nb2listw(COL.nb))\r
+p1 <- predict(COL.lag.eig, newdata = data.out.of.sample,\r
+ listw = listw.all.sample)\r
class(p1)\r
-p2 <- predict(COL.lag.eig, newdata = COL.OLD[45:49,],\r
+p2 <- predict(COL.lag.eig, newdata = data.out.of.sample,\r
pred.type = "trend", type = "trend")\r
#type option for retrocompatibility with spdep 0.5-92\r
class(p2)\r
\r
-imp.exact <- impacts(COL.lag.eig, listw = nb2listw(COL.nb))\r
+imp.exact <- impacts(COL.lag.eig, listw = listw.in.sample)\r
class(imp.exact)\r
-imp.sim <- impacts(COL.lag.eig, listw = nb2listw(COL.nb), R = 200)\r
+imp.sim <- impacts(COL.lag.eig, listw = listw.in.sample, R = 200)\r
class(imp.sim)\r
@ %def\r
\r