Learn R Programming

RnavGraph (version 0.1.8)

ng_data: Create an NG_data object to be used by a navGraph session

Description

NG_data objects wrap the data to be explored and some meta data such as the data name, variable short names, the group identifier and text labels for each observation.

Usage

ng_data(name, data, shortnames = character(0), group = numeric(0), labels = character(0))

Arguments

name
Character string containing no spaces. Note that for a single navGraph session, the names of all the NG_data objects passed by to navGraph must be unique.
data
data.frame with only numeric variables.
shortnames
If the variable names of the data argument are too long or contain spaces, shortnames can be specified.
group
Vector of group identifiers for each observation.

For the tk2d display, one can use color names (see colors) to map a certain color directly to the objects.

labels
Factor- or character sting vector with labels for each observation.

Value

NG_data object.

See Also

navGraph, shortnames-methods, ng_get-methods, ng_set-methods

Examples

Run this code
## minimal example
ng.iris <- ng_data(name = "iris", data = iris[,1:4])
ng.iris ## see output


## full specification
ng.iris <- ng_data(name = "iris", data = iris[,1:4],
		shortnames = c('s.L', 's.W', 'p.L', 'p.W'),
		group = iris$Species,
		labels = substr(iris$Species,1,2))

## see shortnames
shortnames(ng.iris)
## change shortnames
shortnames(ng.iris) <- c("a","b","c","d")
## see variable names
names(ng.iris)
## change variable names
names(ng.iris) <- LETTERS[1:4]

## ng_get
ng_get(ng.iris)
ng_get(ng.iris,"group")

## ng_set
ng_set(ng.iris)
ng_set(ng.iris,"group") <- iris$Species

Run the code above in your browser using DataLab