read_unitted: Read a unitted data.frame from a text file that was written...

Description Usage Arguments Value Examples

View source: R/write.R

Description

Read a unitted data.frame from a text file that was written using write_unitted.

Usage

1
2
read_unitted(file, comment.char = "#", header = TRUE, sep = "\t",
  stringsAsFactors = FALSE, ..., attach.units = TRUE)

Arguments

file

The file to read in

comment.char

a single-character string. should describe any comments INCLUDING the special character, if any, that begins the units line (i.e., the comment.char that was specified in write_unitted)

header

logical indicating whether to read in the header (and units), as in read.table

sep

character string separating columns of the table, as in read.table

stringsAsFactors

logical indicating whether to convert strings to factors, as in read.table

...

Other arguments passed to read.table.

attach.units

logical. If TRUE, the returned value is unitted. If FALSE, units in the text file are ignored entirely and the return value is a non-unitted data.frame.

Value

a unitted_data.frame if attach.units=TRUE, or a data.frame if attach.units=FALSE.

Examples

1
2
3
4
5
practice <- u(data.frame(x=1:3, y=9:7, row.names=as.character(1:3)), c(x="grapes","seeds"))
write_unitted(practice, file="practice.tsv")
read_unitted("practice.tsv")
all.equal(practice, read_unitted("practice.tsv"))
file.remove("practice.tsv")

appling/unitted documentation built on July 24, 2017, 8:40 a.m.