Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

strtrim: Trim Character Strings to Specified Display Widths

strtrimR Documentation

Trim Character Strings to Specified Display Widths

Description

Trim character strings to specified display widths.

Usage

strtrim(x, width)

Arguments

x

a character vector, or an object which can be coerced to acharacter vector byas.character.

width

Positive integer values: recycled to the length ofx.

Details

‘Width’ is interpreted as the display width in a monospacedfont. What happens with non-printable characters (such as backspace, tab)is implementation-dependent and may depend on the locale (e.g., theymay be included in the count or they may be omitted).

Using this function rather thansubstr is important whenthere might be double-width (e.g., Chinese/Japanese/Korean) charactersin the character vector.

Value

A character vector of the same length and with the same attributesasx (after possible coercion).

Elements of the result will have the encoding declared as that ofthe current locale (seeEncoding) if the correspondinginput had a declared encoding and the current locale is either Latin-1or UTF-8.

Examples

strtrim(c("abcdef", "abcdef", "abcdef"), c(1,5,10))

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