Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

read.AnnotatedDataFrame

Read and write 'AnnotatedDataFrame'


Description

Create an instance of class AnnotatedDataFrame by reading a file, or save an AnnotatedDataFrame to a file.

Usage

read.AnnotatedDataFrame(filename, path,
     sep = "\t", header = TRUE, quote = "", stringsAsFactors = FALSE, 
     row.names = 1L,
     varMetadata.char="#",
     widget = getOption("BioC")$Base$use.widgets,
     sampleNames = character(0), ...) 
write.AnnotatedDataFrame(x, file="", varMetadata.char="#", ...,
     append=FALSE, fileEncoding="")

Arguments

filename, file

file or connection from which to read / write.

x

An instance of class AnnotatedDataFrame.

path

(optional) directory in which to find filename.

row.names

this argument gets passed on to read.table and will be used for the row names of the phenoData slot.

varMetadata.char

lines beginning with this character are used for the varMetadata slot. See examples.

sep, header, quote, stringsAsFactors, ...

further arguments that get passed on to read.table or write.table.

widget

logical. Currently this is not implemented, and setting this option to TRUE will result in an error. In a precursor of this function, read.phenoData, this option could be used to open an interactive GUI widget for entering the data.

sampleNames

optional argument that could be used in conjunction with widget; do not use.

append, fileEncoding

Arguments as described in write.table

.

Details

The function read.table is used to read pData. The argument varMetadata.char is passed on to that function as its argument comment.char. Lines beginning with varMetadata.char are expected to contain further information on the column headers of pData. The format is of the form: # variable: textual explanation of the variable, units, measurement method, etc. (assuming that # is the value of varMetadata.char). See also examples.

write.AnnotatedDataFrame outputs varLabels and varMetadata(x)$labelDescription as commented header lines, and pData(x) as a with write.table.

Value

read.AnnotatedDataFrame: An instance of class AnnotatedDataFrame

write.AnnotatedDataFrame: NULL, invisibly.

Author(s)

Martin Morgan <mtmorgan@fhcrc.org> and Wolfgang Huber, based on read.phenoData by Rafael A. Irizarry.

See Also

AnnotatedDataFrame for additional methods, read.table for details of reading in phenotypic data

Examples

exampleFile = system.file("extdata", "pData.txt", package="Biobase")

adf <- read.AnnotatedDataFrame(exampleFile)
adf
head(pData(adf))
head(noquote(readLines(exampleFile)), 11)

write.AnnotatedDataFrame(adf)           # write to console by default

Biobase

Biobase: Base functions for Bioconductor

v2.50.0
Artistic-2.0
Authors
R. Gentleman, V. Carey, M. Morgan, S. Falcon
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.