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

Description Usage Arguments Value Author(s) See Also Examples

View source: R/ng_data.R

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

1

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.

Author(s)

Adrian Waddell and R. Wayne Oldford

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## 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

RnavGraph documentation built on May 29, 2017, 4:18 p.m.