wvc: Create a 'WeightedVariable.categorical' object.

Description Usage Arguments Value Author(s) See Also Examples

Description

The wvc function is a generic S4 method for creating a WeightedVariable.categorical object.

Usage

1
2
3
4
5
wvc(
  variable,
  weights = rep(1, length(variable)),
  infos = list()
)

Arguments

variable

a categorical variable, i.e. either a factor or a character

weights

a numeric vector for weighting, for example non-response weights.

infos

a list for storing other information if needed.

Value

A WeightedVariable.categorical object.

Author(s)

Emmanuel Rousseaux

See Also

WeightedVariable.categorical

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(iris)
a <- wvc(iris$Species)
a
wv.variable(a)
wv.weights(a)
wv.infos(a)

a <- wvc(as.character(iris$Species))

a <- wvc(
  iris$Species,
  weights = c(rep(1,50), rep(0,100))
)
a

a[1:10]
length(a)

trim documentation built on May 2, 2019, 5:36 p.m.