Reading and Writing Data
The c function has already been introduced as a way to input small amounts of data into R. When the amount of data is large, and especially when typing the data into the console is inappropriate, the scan function can be used. scan is most appropriate when all the data to be read is of the same mode, so that it can be accommodated by a vector or matrix. For reading data with variables of mixed modes, see Section 2.2.
The first argument to scan can be a quoted string or character variable containing the name of a file or a URL, or it can be any of a number of connections (Section 2.1) to allow other input sources. If no first argument is given, scan will read from the console, stopping when a completely blank line is entered.
KeywordsData Frame Character String Summary Method Connection Object Optional Argument
Unable to display preview. Download preview PDF.