soread: Read in StackOverflow pasted table-formatted data

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/soread.R

Description

A wrapper for read.table. Reads a table from text or from the clipboard and creates a data.frame from it.

Usage

1
soread(sep = "", header = TRUE, stringsAsFactors = FALSE, out = "mydf")

Arguments

sep

character. Determines the field separator character passed to read.table.

header

logical. Determines whether the first row consists of names of variables.

stringsAsFactors

logical. Whether strings are converted to factors or remain character variables.

out

character. Desired output object name. Defaults to "mydf".

Details

For many questions at Stack Overflow, the question asker does not properly share their question (for example, using dput or by sharing some commands to make up the data). Most of the time, you can just copy and paste the text into R using read.table(text = "clipboard", header = TRUE, stringsAsFactors = FALSE). This function is basically a convenience function for the above.

The output of soread is automatically assigned to an object in your workspace called "mydf" unless specified using the out argument.

Value

A data.frame as read.table produces.

Note

By default, stringsAsFactors is FALSE which is different to the R default.

Author(s)

Ananda Mahto

See Also

dput, read.table

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
## Copy the following text (select and ctrl-c)

# A B
# 1 2
# 3 4
# 5 6

## Now, just type:

soread()

## End(Not run)

sebastian-c/overflow documentation built on May 29, 2019, 4:56 p.m.