Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

Colon: Colon Operator

ColonR Documentation

Colon Operator

Description

Generate regular sequences.

Usage

from:to   a:b

Arguments

from

starting value of sequence.

to

(maximal) end value of the sequence.

a, b

factors of the same length.

Details

The binary operator: has two meanings: for factorsa:b isequivalent tointeraction(a, b) (but the levels areordered and labelled differently).

For other argumentsfrom:to is equivalent toseq(from, to),and generates a sequence fromfrom toto in steps of1or-1. Valueto will be included if it differs fromfrom by an integer up to a numeric fuzz of about1e-7.Non-numeric arguments are coerced internally (hence withoutdispatching methods) to numeric—complex values will have theirimaginary parts discarded with a warning.

Value

For numeric arguments, a numeric vector. This will be of typeinteger iffrom is integer-valued and the resultis representable in theR integer type, otherwise of type"double" (akamode"numeric").

For factors, an unordered factor with levels labelled asla:lband ordered lexicographically (that is,lb varies fastest).

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)The New S Language.Wadsworth & Brooks/Cole.
(for numeric arguments: S does not have: for factors.)

See Also

seq (ageneralization offrom:to).

As an alternative to using: for factors,interaction.

For: used in the formal representation of an interaction, seeformula.

Examples

1:4pi:6 # real6:pi # integerf1 <- gl(2, 3); f1f2 <- gl(3, 2); f2f1:f2 # a factor, the "cross"  f1 x f2

What can we improve?

R Package Documentation

Browse R Packages

We want your feedback!

Note that we can't provide technical support on individual packages. You should contact the package authors for that.

 
Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, readEmbedding Snippets.

Close

[8]ページ先頭

©2009-2026 Movatter.jp