getsingle: getsingle extracts a single number from an input line of...

View source: R/datalow_utils.r

getsingleR Documentation

getsingle extracts a single number from an input line of characters

Description

getsingle splits up a text line and translates the first non- empty character string into a number.

Usage

getsingle(inline, sep = ",")

Arguments

inline

the line of text, usually taken after using readLines

sep

the separator used to divide the numbers from descriptive text. defaults to a comma.

Value

a single number

Examples

## Not run: 
x <- "12.3 , this is a number"
y <- "21.3 # 22.3 # here are two numbers"
getsingle(x)
getsingle(y,sep="#")

## End(Not run)

haddonm/datalowSA documentation built on Nov. 5, 2023, 6:40 p.m.