Learn R Programming

Zelig (version 3.5.1)

gsource: Read Data As a Space-Delimited Table

Description

The gsource function allows you to read a space delimited table as a data frame. Unlike scan, you may use gsource in a sourceed file, and unlike read.table, you may use gsource to include a small (or large) data set in a file that also contains other commands.

Usage

gsource(var.names = NULL, variables)

Arguments

var.names
An optional vector of character strings representing the column names. By default, var.names = NULL.
variables
A single character string representing the data.

Value

  • The output from gsource is a data frame, which you may save to an object in your workspace.

See Also

read.table, scan

Examples

Run this code
data <- gsource(variables =  "
                 1 2 3 4 5    
                 6 7 8 9 10   
                 3 4 5 1 3    
                 6 7 8 1 9    ")

data <- gsource(var.names = "Vote Age Party", variables = "
                             0    23 Democrat             
                             0    27 Democrat             
			     1    45 Republican           
                             1    65 Democrat             ")

Run the code above in your browser using DataLab