A Test File

We load the ascii package and set the output type as "pandoc".

library(ascii)
options(asciiType="pandoc")

A simple example: the integers from 1 to 10 are

ascii(1:10)
print(1:20)

We can also emulate a simple calculator:

1 + 1
1 + pi
sin(pi/2)

Now we look at Gaussian data:

library(stats)
set.seed(12345)
ascii(x <- rnorm(20))
ascii(t1 <- t.test(x))

Note that we can easily integrate some numbers into standard text: The third element of vector x is r x[3], the p-value of the test is r format.pval(t1$p.value).

Now we look at a summary of the famous iris data set, and we want to see the commands in the code chunks:

data(iris)
ascii(summary(iris),header=TRUE)
library(graphics)
pairs(iris)
boxplot(Sepal.Length~Species, data=iris)

Finally, we test the new asciiCoefmat function:

library(stats)
x = y = 1:10
y[1] = 5
lm(y ~ x) |> summary() |> coef() |> asciiCoefmat()
library(stats)
x = y = 1:10
y[1] = 5
lm(y ~ x) |> summary()


Try the ascii package in your browser

Any scripts or data that you put into this service are public.

ascii documentation built on May 29, 2024, 6:10 a.m.