Statistical Analysis: an Introduction using R/R/Objects

From Wikibooks, open books for an open world
Jump to: navigation, search


table() is a more advanced version of tabulate(): it doesn't produce a vector, but a "table" object.
Crystal Clear app terminal.png Input:

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

c, cpp, bash, html4strict, text, java, latex, javascript, python, xml, csharp, php, css, asm, sql, pascal, matlab, html5, haskell, vb, lisp, ruby, ada, oracle11, dos, rsplus, fortran, d, bnf, ocaml, pcre, perl, vhdl, actionscript, lua, bibtex, go, bf, cobol, ini, delphi, arm, scheme, objc, prolog, actionscript3, mysql, qbasic, asp, algol68, groovy, erlang, abap, email, powershell, ecmascript, glsl, sas, apache, yaml, java5, vbnet, reg, cfm, fsharp, scala, applescript, gwbasic, clojure, pli, robots, tsql, whois, freebasic, verilog, llvm, visualfoxpro, sparql, tcl, plsql, coffeescript, scilab, dot, autoit, boo, mirc, lolcode, gnuplot, eiffel, j, teraterm, oorexx, diff, smalltalk, cmake, avisynth, perl6, xpp, typoscript, basic4gl, make, awk, e, gml, jquery, zxbasic, systemverilog, 6502acme, properties, oracle8, q, purebasic, pic16, ldif, rexx, unicon, urbi, modula3, mpasm, locobasic, progress, visualprolog, vala, octave, winbatch, oz, autohotkey, cadlisp, euphoria, pycon, oobas, povray, thinbasic, 68000devpac, mmix, modula2, cil, mxml, io, blitzbasic, parigp, oberon2

Crystal Clear app kscreensaver.png Result:
> table(replicate(1000, max(table(sample(1:6, 5, TRUE)))))

 1   2   3   4   5 

 90 694 198  17   1 
You may get slightly different numbers, because of the random nature of the simulation. But over 1000 times, they should even out