Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 93

Generate Factors with the Function gl() Function use for gl()

Оглавление

gl(n, k, length = n*k, labels = seq_len(n), ordered = FALSE) with

 n: The number of levels

 k: The number of replications (for each level)

 length (optional): An integer giving the length of the result

 labels (optional): A vector with the labels

 ordered: A boolean variable indicating whether the results should be ordered.

gl()

gl(3,2,,c(“bad”,“average”,“good”),TRUE) ## [1] bad bad average average good good ## Levels: bad < average < good

Figure 4.2: The factor objects appear now in a logical order.

The Big R-Book

Подняться наверх