getvector: getvector extracts a vector of numbers from a line of...

View source: R/datalow_utils.r

getvectorR Documentation

getvector extracts a vector of numbers from a line of characters

Description

getvector when reading in a csv file using readLines, getvector extarcts a line of numbers from a specified line within the readLine object.This function works out how many numbers there are. If you wish to add a comment at the end of a vector of numbers it must be separated from tehm by the separator. e.g. a comma

Usage

getvector(indat, locate, sep = ",")

Arguments

indat

the readLines object

locate

the line number from which to extract the numbers

sep

the separator between numbers, defaults to ","

Value

a vector of numbers

Examples

## Not run: 
x <- "12.3, 15.1, 8.7,10.3,  # this is a vector of numbers"
y <- "21.3 # 22.3 # 8.7 # 10.3 # here are four numbers"
getvector(x)
getvector(y,sep="#")

## End(Not run)

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