Learn R Programming

xps (version 1.32.0)

export.root: Export data from ROOT file

Description

Export data as text files directly from a ROOT file.

Usage

export.root(datafile = character(0), schemefile = character(0), treeset = character(0), treename = "*", treetype = character(0), varlist = "*", outfile = character(0), sep = "\t", as.dataframe = FALSE, verbose = TRUE)

Arguments

datafile
name of ROOT data file including full path
schemefile
name of ROOT scheme file including full path
treeset
name of subdirectory in ROOT file where trees are stored
treename
name of ROOT tree to export.
treetype
type of tree(s) to export, see validTreetype.
varlist
names of tree leaves to export.
outfile
name of output file.
sep
column separator
as.dataframe
if TRUE a data.frame will be returned.
verbose
logical, if TRUE print status information.

Value

If as.dataframe is TRUE, the data will be imported into the current R session as data.frame. Otherwise, NULL will be returned.

Details

Export data as text files directly from a ROOT file.

See Also

export, export-methods

Examples

Run this code
## export data directly from root file
schemefile <- paste(path.package("xps"),"schemes/SchemeTest3.root",sep="/")
datafile   <- paste(path.package("xps"),"rootdata/DataTest3_cel.root",sep="/")
data <- export.root(datafile, schemefile, "DataSet", "*", "cel", "*", "DataOutFile.txt", as.dataframe = TRUE,verbose=FALSE)
head(data)

Run the code above in your browser using DataLab