sparkline {epanetReader}R Documentation

Sparkline

Description

Create sparkline object by extracting from a data frame

Usage

sparkline(df, id.var, ID, yvar, xvar)

Arguments

df

data.frame from which data for the sparkline is extracted

id.var

variable in df with IDs

ID

value in id.var on which to extract

yvar

name of variable for the y values in the sparkline

xvar

optional name of variable for horizontal axis of sparkline plots

Details

Creates an object with info for a single sparkline by extracting from a data.frame. The function works on data.frames with one column of ID variables and possibly several columns of other variables. The main use is as a helper function for building up a sparklineTable.

Examples

## look at the names in the built-in data set Theoph
names(Theoph) 
## make sparkline object for the concentration over time in subject 2
sl <- sparkline(df= Theoph, id.var = 'Subject', ID = 2, yvar='conc', xvar = 'Time') 
plot(sl)

[Package epanetReader version 0.7.3 Index]