ivar {iplots}R Documentation

Data (ivar) manipulation functions

Description

The following functions are used to mainpulate variables for iplots:

ivar.data returns the data associated with an iVar variable

ivar.new creates a new iVar variable in the current iSet using the supplied data

ivar.new.map same as ivar.new but for map (polygon) data

ivar.update replaces the content of a variable

iVar variables (deprecated - use iset.new instead)

[.ivar allows data subsetting of ivar contents

[<-.ivar allows partial replacement of ivar contents

length.ivar returns the length of a variable

iset.updateVars notifies all plots that variables have been changed. This function should not be normally used, because notification happens automatically, unless batch updates are performed.

Usage

ivar.data(var)
ivar.new(name = deparse(substitute(cont)), cont)
ivar.new.map(name, x, y)
ivar.update(var, cont, batch = FALSE)
## S3 method for class 'ivar'
length(x)
## S3 method for class 'ivar'
x[i, ...]
## S3 replacement method for class 'ivar'
x[...] <- value
## S3 method for class 'ivar'
print(x, ...)

iset.updateVars()

Arguments

var

an existing iVar variable

cont

desired contents - usually a numeric vector or a factor

name

variable name in an iSet

batch

if set to TRUE then plots are not automatically notified about the change. This allows an update of multiple variables in batches without constant re-painting of the plots.

x

object to subset or x-coordinate of the map data

y

y-coordinate of the map data

i

index - if missing all data are returned

...

indices

value

replacement value

Details

All data that will are displayed in an iPlot are organized in iSets. Each iSet contains variables, called iVars, that represent the displayed data. Typically an iSet corresponds to a data frame and an iVar corresponds to a column in a data frame. All variables in one iSet must have the same length and indexing order. This allows iPlots to perform proper linking of all plots.

Before some data can be displayed in an iPlot, they are put into an ivar using the ivar.new function. Each variable has a name that is unique within an iSet. This process is automatic if you pass arbitrary vectors to the iPlots plotting functions. However, it is possible (and desirable) to register variables beforehand using iset.new. It is much faster to use iVars in the plots instead of the raw data.

Once an iVar is created, it is merely a reference to the data in the iSet. The regular subsetting operators [ or ivar.data function can be used to retrieve the data back to R.

In addition, it is possible to update the contents of an iVar using the ivar.update function. Once the variable is updated, all plots that use the variable will be updated, too, and reflect the change, unless batch was set to TRUE. The notification is performed using the iset.updateVars function.

Methods

show

signature(object = "ivar"): is mapped to print.ivar

See Also

iset.new, ibar, iplot.list, iplot.opt

Examples

data(iris)
s <- iset.new("iris", iris)
rm(iris) # we don't need iris anymore
s[1:5,]
s$Species
s$Species[]
s[1:5,c("Sepal.Width","Sepal.Length")]
s$Test <- factor(c("yes","no")[runif(dim(s)[1])+1.5])
s[1:5,]
iplot(s$Sepal.Length, s$Petal.Length)
ibar(s$Species)
iplot.location(400,,TRUE)
iset.select(s$Test[]=="yes")
ibar(s$Test)
iplot.location(400,250,TRUE)
# use iset.rm() to remove everything

[Package iplots version 1.1-8 Index]