Movatterモバイル変換


[0]ホーム

URL:


Skip to contents

Expand tabs in a string to spaces

Source:R/expandtabs.R
strs_expandtabs.Rd

strs_expandtabs replaces each tab character (\\t) in a string with aspecified number of spaces. This function behaves similarly to Python'sstr.expandtabs() method.

Usage

strs_expandtabs(string, tabsize=8)

Arguments

string

A character vector where each element is a string in which toexpand tabs.

tabsize

An integer specifying the number of spaces to replace each tabcharacter with. Defaults to 8.

Value

A character vector of the same length asstring, with tabs in eachelement replaced bytabsize number of spaces.

See also

Python str.expandtabs() documentation

Examples

strs_expandtabs("hello\tworld",4)#> [1] "hello    world"strs_expandtabs("one\ttwo\tthree",8)#> [1] "one        two        three"

[8]ページ先頭

©2009-2025 Movatter.jp