scanText: Scan a Character String

View source: R/CGIwithR.R

scanTextR Documentation

Scan a Character String

Description

Useful for converting data entered via a HTML textarea, for example, into a list or vector for further processing.

Usage

scanText(string, what = character(0), ...)

Arguments

string

A character string, typically numbers or words separated by white space

what

As for scan. The type of what gives the type of data to be read. If what is a list, it is assumed that the lines of the data file are records each containing length(what) items (“fields”). The supported types are logical, integer, numeric, complex, character and list: list values should have elements which are one of the first five types listed or NULL.

...

Other arguments to be passed to scan

Value

A list or vector.

Author(s)

David Firth d.firth@warwick.ac.uk

Examples

scanText("A few short words")
as.numeric(scanText("1 2 3\n89 90"))
scanText("A B C \n 4 5 6", what = list("A", "A", "A", 0, 0, 0))

duncantl/CGIwithR documentation built on Nov. 23, 2023, 3:38 p.m.