A wrapper for read.table. Reads a table from text or from the clipboard and creates a data.frame from it.
soread( sep = "", header = TRUE, stringsAsFactors = FALSE, skipAfterHeader = NULL, out = "mydf" )
sep | character. Determines the field separator character passed
to |
---|---|
header | logical. Determines whether the first row consists of names of variables. |
stringsAsFactors | logical. Whether strings are converted to factors or remain character variables. Defaults to `FALSE` |
skipAfterHeader | numeric. Some newer print methods print additional information just below the headers (for example, `tibble`s and `data.table`s). If `skipAfterHeader = TRUE`, the second line will be removed. If `skipAfterHeader` is a numeric value, those lines after the header row will be removed before reading the data. |
out | character. Desired output object name. Defaults to |
A data.frame as read.table
produces.
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.
By default, `stringsAsFactors` is `FALSE` which is different to the R default in R versions prior to 4.0.
Ananda Mahto
if (FALSE) { ## Copy the following text (select and ctrl-c) # A B # 1 2 # 3 4 # 5 6 ## Now, just type: soread() }