Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

Extract.factor: Extract or Replace Parts of a Factor

Extract.factorR Documentation

Extract or Replace Parts of a Factor

Description

Extract or replace subsets of factors.

Usage

## S3 method for class 'factor'x[..., drop = FALSE]## S3 method for class 'factor'x[[...]]## S3 replacement method for class 'factor'x[...] <- value## S3 replacement method for class 'factor'x[[...]] <- value

Arguments

x

a factor

...

a specification of indices – seeExtract.

drop

logical. If true, unused levels are dropped.

value

character: a set of levels. Factor values are coerced tocharacter.

Details

When unused levels are dropped the ordering of the remaining levels ispreserved.

Ifvalue is not inlevels(x), a missing value isassigned with a warning.

Anycontrasts assigned to the factor are preservedunlessdrop = TRUE.

The[[ method supports argumentexact.

Value

A factor with the same set of levels asx unlessdrop = TRUE.

See Also

factor,Extract.

Examples

## following example(factor)(ff <- factor(substring("statistics", 1:10, 1:10), levels = letters))ff[, drop = TRUE]factor(letters[7:10])[2:3, drop = TRUE]

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