Learn R Programming

gor (version 2.0)

sum_g: Sum of the higher terms of a list

Description

Sum of the higher terms of a list

Usage

sum_g(L, m)

Value

The sum of the m higher terms of the list L

Arguments

L

A numeric sequence

m

A scalar

Author

Cesar Asensio

Details

It sorts the list L in decreasing order and returns the sum of the first m components of the ordered list.

Examples

Run this code
sum_g(1:10, 3)  # 8 + 9 + 10 = 27

Run the code above in your browser using DataLab