# ftable.formula

0th

Percentile

##### Formula Notation for Flat Contingency Tables

Produce or manipulate a flat contingency table using formula notation.

Keywords
category
##### Usage
# S3 method for formula
ftable(formula, data = NULL, subset, na.action, …)
##### Arguments
formula

a formula object with both left and right hand sides specifying the column and row variables of the flat table.

data

a data frame, list or environment (or similar: see model.frame) containing the variables to be cross-tabulated, or a contingency table (see below).

subset

an optional vector specifying a subset of observations to be used. Ignored if data is a contingency table.

na.action

a function which indicates what should happen when the data contain NAs. Ignored if data is a contingency table.

further arguments to the default ftable method may also be passed as arguments, see ftable.default.

##### Details

This is a method of the generic function ftable.

The left and right hand side of formula specify the column and row variables, respectively, of the flat contingency table to be created. Only the + operator is allowed for combining the variables. A . may be used once in the formula to indicate inclusion of all the remaining variables.

If data is an object of class "table" or an array with more than 2 dimensions, it is taken as a contingency table, and hence all entries should be nonnegative. Otherwise, if it is not a flat contingency table (i.e., an object of class "ftable"), it should be a data frame or matrix, list or environment containing the variables to be cross-tabulated. In this case, na.action is applied to the data to handle missing values, and, after possibly selecting a subset of the data as specified by the subset argument, a contingency table is computed from the variables.

The contingency table is then collapsed to a flat table, according to the row and column variables specified by formula.

##### Value

A flat contingency table which contains the counts of each combination of the levels of the variables, collapsed into a matrix for suitably displaying the counts.

ftable, ftable.default; table.
library(stats) # NOT RUN { Titanic x <- ftable(Survived ~ ., data = Titanic) x ftable(Sex ~ Class + Age, data = x) # }
{"ft_lang_label":"__label__en","ft_lang_prob":0.7207568,"math_prob":0.8729933,"size":2201,"snap":"2020-10-2020-16","text_gpt3_token_len":515,"char_repetition_ratio":0.15885298,"word_repetition_ratio":0.0054200543,"special_character_ratio":0.21263063,"punctuation_ratio":0.123786405,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96380883,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-04-08T19:42:14Z\",\"WARC-Record-ID\":\"<urn:uuid:28436fd8-0564-43dd-bfd4-6211e6fdbbbc>\",\"Content-Length\":\"16801\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:faf5e4e8-ac8d-44e5-a789-66167e8a4228>\",\"WARC-Concurrent-To\":\"<urn:uuid:e04c4a8a-6c0e-41ce-8741-754d3a08b815>\",\"WARC-IP-Address\":\"18.214.137.216\",\"WARC-Target-URI\":\"https://www.rdocumentation.org/packages/stats/versions/3.6.0/topics/ftable.formula\",\"WARC-Payload-Digest\":\"sha1:CIDL3Y6RHONLLJDR67RHCVALKR2ZA4IG\",\"WARC-Block-Digest\":\"sha1:65PTAJYPTRY6G4JC7EVPF4AGE7YEUZEL\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-16/CC-MAIN-2020-16_segments_1585371821680.80_warc_CC-MAIN-20200408170717-20200408201217-00477.warc.gz\"}"}