Learn R Programming

rportfolios (version 1.0-1)

collapse.segments: Collapse a list or vectors of portfolio segments

Description

This function returns a vector of investment indices from the given segments vector or list of vectors.

Usage

collapse.segments(segments)

Arguments

segments
A vector or list of vectors that defint the portfolio segments

Value

A vector of investment indices.

Examples

Run this code
###
### define the segments
###
    I <- list()
    I[[1]] <- c( 1, 2, 3 )
    I[[2]] <- c( 4, 5 )
    I[[3]] <- c( 6, 7 )
    I[[4]] <- c( 8, 9, 10 )
    collapse.segments( I )
    collapse.segments( I[[1]] )
    collapse.segments( I[[2]] )
    collapse.segments( I[[3]] )
    collapse.segments( I[[4]] )

Run the code above in your browser using DataLab