File: OtherPackagesGallery.R

package info (click to toggle)
r-cran-xtable 1%3A1.8-4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 992 kB
  • sloc: sh: 19; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 1,164 bytes parent folder | download
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
## ----set, include=FALSE--------------------------------------------------
library(knitr)
opts_chunk$set(fig.path = 'Figures/other', debug = TRUE, echo = TRUE)
opts_chunk$set(out.width = '0.9\\textwidth')

## ----package, results='asis'------------------------------
library(xtable)
options(xtable.floating = FALSE)
options(xtable.timestamp = "")
options(width = 60)
set.seed(1234)

## ----zoo, results = 'asis'--------------------------------
library(zoo)
xDate <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1
as.ts(xDate)
x <- zoo(rnorm(5), xDate)
xtable(x)

## ----zoots, results = 'asis'------------------------------
tempTs <- ts(cumsum(1 + round(rnorm(100), 0)),
              start = c(1954, 7), frequency = 12)
tempTable <- xtable(tempTs, digits = 0)
tempTable
tempZoo <- as.zoo(tempTs)
xtable(tempZoo, digits = 0)

## ----survival, results = 'asis'---------------------------
library(survival)
test1 <- list(time=c(4,3,1,1,2,2,3),
              status=c(1,1,1,0,1,1,0),
              x=c(0,2,1,1,1,0,0),
              sex=c(0,0,0,0,1,1,1))
coxFit <- coxph(Surv(time, status) ~ x + strata(sex), test1)
xtable(coxFit)