This is an example of the default aesthetics for tables, created by print(xtable()), if you simply push the “Knit HTML” buttom in RStudio.
library(xtable)
myTable <- xtable(gDat[1:10, ])
digits(myTable) <- c(0, 0, 0, 0, 0, 2, 2)
print(myTable, type = "html", include.rownames = FALSE)
| country | year | pop | continent | lifeExp | gdpPercap |
|---|---|---|---|---|---|
| Afghanistan | 1952 | 8425333 | Asia | 28.80 | 779.45 |
| Afghanistan | 1957 | 9240934 | Asia | 30.33 | 820.85 |
| Afghanistan | 1962 | 10267083 | Asia | 32.00 | 853.10 |
| Afghanistan | 1967 | 11537966 | Asia | 34.02 | 836.20 |
| Afghanistan | 1972 | 13079460 | Asia | 36.09 | 739.98 |
| Afghanistan | 1977 | 14880372 | Asia | 38.44 | 786.11 |
| Afghanistan | 1982 | 12881816 | Asia | 39.85 | 978.01 |
| Afghanistan | 1987 | 13867957 | Asia | 40.82 | 852.40 |
| Afghanistan | 1992 | 16317921 | Asia | 41.67 | 649.34 |
| Afghanistan | 1997 | 22227415 | Asia | 41.76 | 635.34 |
Another example, code taken from Jenny's inclass tutorial
## jFun(subset(gDat, country == 'India')) to see what it does
jCoefs <- ddply(gDat, ~country, jFun)
set.seed(916)
foo <- jCoefs[sample(nrow(jCoefs), size = 15), ]
foo <- xtable(foo)
print(foo, type = "html", include.rownames = FALSE)
| country | intercept | slope |
|---|---|---|
| Lebanon | 58.69 | 0.26 |
| Senegal | 36.75 | 0.50 |
| Dominican Republic | 48.60 | 0.47 |
| Oman | 37.21 | 0.77 |
| Germany | 67.57 | 0.21 |
| Korea, Dem. Rep. | 54.91 | 0.32 |
| Mauritius | 55.37 | 0.35 |
| Slovak Republic | 67.01 | 0.13 |
| Comoros | 40.00 | 0.45 |
| Argentina | 62.69 | 0.23 |
| Central African Republic | 38.81 | 0.18 |
| Ecuador | 49.07 | 0.50 |
| West Bank and Gaza | 43.80 | 0.60 |
| Egypt | 40.97 | 0.56 |
| Myanmar | 41.41 | 0.43 |