You can get Dung’s code here: https://rpubs.com/chidungkt/394265
require(reshape2)
## Loading required package: reshape2
##
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
##
## smiths
require(compositions)
## Loading required package: compositions
## Loading required package: tensorA
##
## Attaching package: 'tensorA'
## The following object is masked from 'package:base':
##
## norm
## Loading required package: robustbase
## Loading required package: energy
## Loading required package: bayesm
## Welcome to compositions, a package for compositional data analysis.
## Find an intro with "? compositions"
##
## Attaching package: 'compositions'
## The following objects are masked from 'package:stats':
##
## cor, cov, dist, var
## The following objects are masked from 'package:base':
##
## %*%, scale, scale.default
library(robCompositions)
## Warning: package 'robCompositions' was built under R version 3.3.3
## Loading required package: data.table
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:reshape2':
##
## dcast, melt
## The following objects are masked from 'package:dplyr':
##
## between, first, last
## The following object is masked from 'package:purrr':
##
## transpose
## Loading required package: pls
## Warning: package 'pls' was built under R version 3.3.3
##
## Attaching package: 'pls'
## The following object is masked from 'package:compositions':
##
## R2
## The following object is masked from 'package:stats':
##
## loadings
## sROC 0.1-2 loaded
##
## Attaching package: 'robCompositions'
## The following object is masked from 'package:compositions':
##
## variation
## The following object is masked from 'package:robustbase':
##
## alcohol
#--------- Plot in Ternary diagram
xGDP = acomp(gdp[,c( "agri_per", "ser_per", "indus_per")])
mnGDP = mean(xGDP)