fillLines: Fill delimited lines with NA values

View source: R/fillLines.R

fillLinesR Documentation

Fill delimited lines with NA values

Description

Fill delimited lines with NA values

Usage

fillLines(object, format = c("csv", "tsv"))

Arguments

object

character.

format

character(1). Delimited input format.

Value

character. Modified character vector, with consistent number of delimited values.

Note

Updated 2023-09-27.

See Also

  • textConnection: For import approach after modification.

Examples

## character ====
## CSV format.
object <- c(
    "\"aaa\",\"bbb\",\"ccc\",\"ddd\"",
    "\"eee\",\"fff\",\"ggg\"",
    "\"hhh\",\"iii\""
)
print(object)
object <- fillLines(object, format = "csv")
print(object)
con <- textConnection(object)
object <- import(con, format = "csv")
print(object)
close(con)

## TSV format.
object <- c(
    "aaa\tbbb\tccc\tddd",
    "eee\tfff\tggg",
    "hhh\tiii"
)
print(object)
object <- fillLines(object, format = "tsv")
print(object)
con <- textConnection(object)
object <- import(con, format = "tsv")
print(object)
close(con)

acidgenomics/brio documentation built on Feb. 1, 2024, 11:47 a.m.