# calcul_: Calculating a class variable In oceanis: Cartography for Statistical Analysis

 calcul_ R Documentation

## Calculating a class variable

### Description

Add to a data table a column whose values can be represented in a class analysis (ratio, part, evolution ...).

The calculation is based on volume data (from the population, for example).

### Usage

```calcul_ratio(data, var1, var2)

calcul_tx_evol_global(data, var1, var2)

calcul_tx_evol_ann_moy(data, var1, var2, nbAnnees)

calcul_part_ens(data, var)

calculette(data, formule = NULL)
```

### Arguments

 `data` tableau de donnees (data.frame). `var1` chaine de caracteres (character). Variable en volume de la table. `var2` chaine de caracteres (character). Variable en volume de la table. `nbAnnees` nombre (numeric). Nombre d'annees appliquable au taux d'evolution annuel moyen. `var` chaine de caracteres (character). Variable en volume de la table. `formule` chaine de caracteres (character). Formule libre pour le calcul d'une variable de classes. Seuls les caracteres + - * / ^ ( ) sont acceptes.

### Details

Les formules utilisees sont :

ratio

`(data[,var1]/data[,var2])*100`

tx_evol_global

`((data[,var2]-data[,var1])/data[,var1])*100`

tx_evol_ann_moy

`((data[,var2]/data[,var1])^(1/nbAnnees)-1)*100`

part_ens

`(data[,var]/sum(data[,var],na.rm = TRUE))*100`

### Value

Retourne un objet data.frame.

### Examples

```
data("donnees_monoloc")

ratio <- calcul_ratio(data = donnees_monoloc, var1 = "POP_2010", var2 = "POP_2015")
teg <- calcul_tx_evol_global(data = donnees_monoloc, var1 = "POP_2010", var2 = "POP_2015")
team <- calcul_tx_evol_ann_moy(data = donnees_monoloc, var1 = "POP_2010", var2 = "POP_2015",
nbAnnees = 5)
part <- calcul_part_ens(data = donnees_monoloc, var = "POP_2015")

```

oceanis documentation built on July 13, 2022, 5:06 p.m.