diff options
author | gbrandl <devnull@localhost> | 2008-03-28 23:53:18 +0100 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2008-03-28 23:53:18 +0100 |
commit | d06bbbd17be3be7cde83cac1a9dfae24ae60e34b (patch) | |
tree | 9a788350b55dd15a64f0b09ecbac74f1e71bc21a /tests/examplefiles/test.R | |
parent | d16046969a903bde0468ecbeddc0f7a060439083 (diff) | |
download | pygments-d06bbbd17be3be7cde83cac1a9dfae24ae60e34b.tar.gz |
Enhance testfile.
Diffstat (limited to 'tests/examplefiles/test.R')
-rw-r--r-- | tests/examplefiles/test.R | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/examplefiles/test.R b/tests/examplefiles/test.R index 4ec76419..c53edd13 100644 --- a/tests/examplefiles/test.R +++ b/tests/examplefiles/test.R @@ -82,3 +82,38 @@ list( logemlik=loglik, ### logemlikv2=loglik2, nits=temp2$nf, message=temp2$message ) } +library("graphics") + +par(mfrow = c(1, 2)) +# plot histogram +x <- rnorm(100) +if (max(x) > 100) + stop("Quite unexpected.") +else + hist(x, plot=TRUE, col="ivory") + +# from doc: lowess +plot(cars, main = "lowess(cars)") + lines(lowess(cars), col = 2) + lines(lowess(cars, f=.2), col = 3) + legend(5, 120, c(paste("f = ", c("2/3", ".2"))), lty = 1, col = 2:3) + +# from doc: is.na +is.na(c(1, NA)) + +# from doc: Extract +y <- list(1,2,a=4,5) +y[c(3,4)] # a list containing elements 3 and 4 of y +y$a # the element of y named a + +# from doc: for +for(n in c(2,5,10,20,50)) { + x <- stats::rnorm(n) + cat(n,":", sum(x2),"\n") +} + +class(fo <- y ~ x1*x2) # "formula" + + + + |