Skip to contents

splitin2 splints a character string into a two-element data.frame containing a number and a string, in this order.

Usage

splitin2(x, input_type = input_type, remove_quotes = TRUE)

Arguments

x

single character string.

input_type

character string that can take two values: "data" or "title".

remove_quotes

logical, if set to TRUE any single quotation marks will be removed from the second element.

Value

A data.frame with one row and two columns.

Details

Function splitin2 has been written to allow splitting string from CENTURY files into two parts. Input 'x' must be a single character string containing either a number and a text (e.g. "45 dd")

Examples

# See the difference when 'input_type' changes value.
str(splitin2("4.5 'This'", "data"))
#> Error in splitin2("4.5 'This'", "data"): could not find function "splitin2"
str(splitin2("45 'This'", "title"))
#> Error in splitin2("45 'This'", "title"): could not find function "splitin2"

# We set 'remove_quotes' to FALSE.
str(splitin2("4.5 'This'", "data", FALSE))
#> Error in splitin2("4.5 'This'", "data", FALSE): could not find function "splitin2"
str(splitin2("45 'This'", "title", FALSE))
#> Error in splitin2("45 'This'", "title", FALSE): could not find function "splitin2"