Learn R Programming

tdata (version 0.3.0)

f.cross.section: Create a Cross-Section Frequency

Description

This frequency is typically used for indexed data. It is represented by an integer that indicates the position of the observation.

Usage

f.cross.section(position)

Value

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

class

Determines the class of this frequency.

position

Determines the position.

Arguments

position

An integer representing the position of the observation.

Details

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

  • Character Format "#" (the number is the position)

  • Class Id "cs"

Examples

Run this code

cs0 <- f.cross.section(10) # this initializes a cross-section frequency

cs0_value_str <-  as.character(cs0) # this will be '10'.
cs0_class_str <- get.class.id(cs0) # this will be 'cs'.

cs_new <- as.frequency("20", "cs")
#      this is a cross-section frequency. It points to position 20.

Run the code above in your browser using DataLab