f.list.string {tdata}R Documentation

Create a List-String Frequency

Description

This frequency is typically used for labeled data. It is generally a list, but it can also be used to label observations outside this list.

Usage

f.list.string(items, value)

Arguments

items

The items in the list.

value

The current item.

Details

In order to use the as.frequency function for this type of frequency, you need the following information:

Value

An object of class ldtf, which is also a list with the following members:

class

Determines the class of this frequency.

items

Determines the items.

value

Determines the value.

Examples


L0 <- f.list.string(c("A","B","C","D"), "C")

L0_value_str <-  as.character(L0) # this will be 'C'.
L0_class_str <- get.class.id(L0) # this will be 'Ls:A;B;C;D'.

L_new <- as.frequency("A", "Ls:A;B;C;D")
L_new0 <- as.frequency("A", "Ls") # compared to the previous one, its items will be empty

# Don't make the following mistakes:

L_invalid <- try(as.frequency("E", "Ls:A;B;C;D")) # 'E' is not a member of the list
L_invalid <- try(f.list.string(c("A","B","C","D"), "E"))



[Package tdata version 0.3.0 Index]