setLevels-methods: The 'setLevels' method

Description Usage Arguments Value Author(s) Examples

Description

Sets new levels to a discrete distribution.

Usage

1

Arguments

this

an object of the class mtkDomain or mtkLevels.

levels

an object of the class mtkLevels or a list from which we can create an object of the class mtkLevels.

Value

invisible

Author(s)

Juhui WANG, MIA-jouy, INRA

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Create a  new mtkLevels for a discrete distribution

	l <- mtkLevels(type='categorical', levels = c(1,2,3,4,5), weights=rep(0.2, 5))
# Change the levels'name to ('a','b','c','d','e')
	setLevels(l, c('a','b','c','d','e'))
	
# Create a  new domain with a discrete distribution
	d <- mtkDomain(distributionName="discrete", domainNominalValue=3, 
			distributionParameters = list(type='categorical',
		 	levels = c(1,2,3,4,5), weights=rep(0.2, 5)))
		 
# Create a  new mtkLevels for a discrete distribution and assign it to the domain

	l <- mtkLevels(type='categorical', levels = c('a','b','c','d','e'), weights=rep(0.2, 5))
	setLevels(d, l)

# Change the domain's levels to type='categorical', levels = c(5,4,3,2,1), weights=rep(0.2, 5)
	
	setLevels(d, levels=list(type='categorical', levels = c(5,4,3,2,1), weights=rep(0.2, 5)))

mtk documentation built on May 2, 2019, 4:15 a.m.