Learn R Programming

tdata (version 0.3.0)

get.seq0: Generate a Sequence from a Range of Frequencies

Description

Use this function to generate a list of character strings, where each element is a string representation of a frequency within the specified range.

Usage

get.seq0(start, length, by = 1)

Value

A list of character strings that represents the sequence.

Arguments

start

The first frequency of the sequence.

length

The length of the sequence.

by

An integer that determines the increment of the sequence.

See Also

get.seq

Examples

Run this code
start <- f.monthly(2020,1)
sequence1 <- get.seq0(start, 24, 1) # this will be '2020M1', '2020M2', ..., '2021M12'
sequence2 <- get.seq0(start, 24, 2) # this will be '2020M1', '2020M3', ..., '2023M11'
sequence3 <- get.seq0(start, 24, 3) # this will be '2020M1', '2020M4', ..., '2025M10'

# backward:
sequence4 <- get.seq0(start, 24, -1) # this will be '2020M1', '2019M12', ..., '2018M2'

# Lists are a little different:
start_l <- f.list.string(c("A","B","C","D"), "C")
sequence5 <- get.seq0(start_l, 5, 1) # this will be 'C', 'D', 'out_item:1', ..., 'out_item:3'

Run the code above in your browser using DataLab