String Representation of a character vector

Description

String Representation of a character vector

Usage

1
2
strVectorRepr(ss, print_out = FALSE, single_quote = TRUE,
  start_with_c = TRUE)

Arguments

ss

character.

print_out

logical. Whether to print out the string representation.

single_quote

Logical, whether to use single quote for wrap strings. Default to TRUE, when set to FALSE, double quote is used.

start_with_c

Logical, whether the representation should start with "c(", when set to FALSE, "(" is used. Default to TRUE.

Value

character.

Author(s)

Kaiyin Zhong, Fan Liu

Examples

1
2
3
4
5
6
7
8
## Not run: 
strVectorRepr(letters[1:3]) == 'c("a", "b", "c")'
strVectorRepr(
  as.character(1:3)) == 'c("1", "2", "3")'
all(eval(parse(text = strVectorRepr(as.character(1:3)))) == 
  c("1", "2", "3"))

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.