R Under development (unstable) (2024-01-24 r85824 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > options(warn=1) > library(compositions) 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': anova, cor, cov, dist, var The following object is masked from 'package:graphics': segments The following objects are masked from 'package:base': %*%, norm, scale, scale.default > #library(compositions,lib.loc="../../compositions.Rcheck") > par(pch=20) > data(SimulatedAmounts) > > geomSetA <- acomp(rbind(c(1,2,3),c(1,1,1))) > geomSetA [,1] [,2] [,3] [1,] "0.1666667" "0.3333333" "0.5000000" [2,] "0.3333333" "0.3333333" "0.3333333" attr(,"class") [1] "acomp" > plot(geomSetA) > ellipses(acomp(geomSetA[1,]),ilrvar2clr(clrvar2ilr(diag(3)))) > > geomSetA <- acomp(rbind(c(a=1,b=2,c=3,d=4),c(1,1,1,1))) > geomSetA a b c d [1,] "0.10" "0.20" "0.30" "0.40" [2,] "0.25" "0.25" "0.25" "0.25" attr(,"class") [1] "acomp" > plot(geomSetA,col=1:2,axes=list(side=-1:-3,pos=0.5)) > > > ellipses(acomp(geomSetA[1,]),ilrvar2clr(clrvar2ilr(diag(4)))) > ellipses(acomp(geomSetA[1,]),ilrvar2clr(clrvar2ilr(diag(4))),thinRatio=1) > ellipses(acomp(geomSetA[1,]),ilrvar2clr(clrvar2ilr(diag(4))),thinRatio=0) > > plot(geomSetA,col=1:2,margin="b") > ellipses(acomp(geomSetA[1,]),ilrvar2clr(clrvar2ilr(diag(4)))) > > plot(rcomp(geomSetA),col=1:2,margin="b") > > # In this file we suppress unnecessary warnings targeting end-users > # Human: if you want to see them, replace suppressWarnings() by I() > suppressWarnings( ellipses(rcomp(geomSetA[1,]),ilrvar2clr(clrvar2ilr(diag(4)))) ) > > > geomSetA <- acomp(rbind( c(2,1,1),c(1,2,1),c(1,1,2),c(1,1,1))) > delta <- acomp(c(0.4,0.9,3)) > plot(geomSetA+delta) > straight(acomp(c(2,1,1))+delta,acomp(c(1,2,1))-acomp(c(2,1,1))) > rr = norm(acomp(c(1,1,2))-acomp(c(1,1,1))) > ellipses(acomp(c(1,1,2))+delta,var=diag(3),r=rr) > ellipses(mean(geomSetA+delta),var=var(geomSetA+delta),r=2) > > > plot(rcomp(geomSetA+delta)) > straight(rcomp(acomp(c(2,1,1))+delta),rcomp(acomp(c(1,2,1))+delta)-rcomp(acomp(c(2,1,1))+delta)) > ellipses(rcomp(acomp(c(1,1,2)+delta)),var=diag(3)-1/3,r=norm(rcomp(acomp(c(1,1,2))+delta)-rcomp(acomp(c(2,1,1))+delta))) > ellipses(mean(rcomp(geomSetA+delta)),var=var(rcomp(geomSetA+delta)),r=2) > > geomSetA <- acomp(rbind( c(2,1,1,1),c(1,2,1,1),c(1,1,2,1),c(1,1,1,2),c(1,1,1,1))) > delta <- acomp(c(0.4,0.9,3,1.2)) > #delta <- acomp(c(1,1,1,1)) > plot(geomSetA+delta,col=1:5,pch=1:5) > straight(acomp(c(2,1,1,1))+delta,acomp(c(1,2,1,1))-acomp(c(2,1,1,1)),steps=100) > #straight(acomp(c(2,1,1,1))+delta,acomp(c(1,2,1,1))-acomp(c(2,1,1,1)),steps=10) > #ellipses(acomp(c(1,1,2,1))+delta,var=diag(4)-1/4,r=norm(acomp(c(1,1,2,1))-acomp(c(1,1,1,1)))) > replot(onlyPanel=c(3,1)) > segments.acomp(acomp(c(2,1,1,1))+delta,acomp(c(1,2,1,1))+delta,col="red") > > ellipses(acomp(c(1,1,1,1))+delta,var=diag(4)-1/4,r=norm(acomp(c(1,1,2,1))-acomp(c(1,1,1,1))),col="blue") > ellipses(mean(geomSetA+delta),var=var(geomSetA+delta),r=2,col="red") > > ellipses(mean(geomSetA+delta),var=var(geomSetA+delta),r=2,col="red",thinRatio=0.1) > > plot(rcomp(geomSetA+delta),col=1:5,pch=1:5) > straight(rcomp(acomp(c(2,1,1,1))+delta),rcomp(acomp(c(1,2,1,1))+delta)-rcomp(acomp(c(2,1,1,1))+delta)) > ellipses(rcomp(acomp(c(1,1,2,1)+delta)),var=diag(4)-1/4,r=norm(rcomp(acomp(c(1,1,2,1))+delta)-rcomp(acomp(c(2,1,1,1))+delta))) > ellipses(mean(rcomp(geomSetA+delta)),var=var(rcomp(geomSetA+delta)),r=2) > > geomSetA <- aplus(rbind( c(2,1,1),c(1,2,1),c(1,1,2),c(1,1,1),c(1.5,1.5,1.5))) > delta <- aplus(c(0.4,0.9,3)) > #delta <- aplus(c(1,1,1)) > plot(geomSetA+delta,xlim=c(0.1,10),ylim=c(0.1,10),logscale=TRUE) > straight(aplus(c(2,1,1))+delta,aplus(c(1,2,1))-aplus(c(2,1,1))) > ellipses(aplus(c(1.5,1.5,1.5))+delta,var=diag(3),r=norm(aplus(c(1,1,2))-aplus(c(1,1,1)))) > ellipses(aplus(c(1,1,1))+delta,var=diag(3),r=norm(aplus(c(1,1,2))-aplus(c(1,1,1)))) > ellipses(mean(geomSetA+delta),var=var(geomSetA+delta),r=2) > lines(geomSetA+delta) > geomSetA <- rplus(rbind( c(2,1,1),c(1,2,1),c(1,1,2),c(1,1,1),c(1.5,1.5,1.5))) > delta <- rplus(c(0.4,0.9,3)) > plot(geomSetA+delta,xlim=c(0.1,10),ylim=c(0.1,10)) > #straight(aplus(c(2,1,1))+delta,aplus(c(1,2,1))-aplus(c(2,1,1))) > ellipses(rplus(c(1.5,1.5,1.5))+delta,var=diag(3),r=norm(rplus(c(1,1,2))-rplus(c(1,1,1)))) > ellipses(mean(geomSetA+delta),var=var(geomSetA+delta),r=2) > > plot(rcomp(sa.lognormals)) > ternaryAxis(side=1:3,pos=0,col.axis="red",col.lab="green") > ternaryAxis(side=1:3,at=1:9/10,labels=expression(9:1,4:1,7:3,3:2,1:1,2:3,3:7,1:4,1:9),pos=0,col.axis="red",col.lab="green") > ternaryAxis(side=rep(-1:-3,3),labels=paste(seq(20,80,by=20),"%"), + pos=rep(c(0,0.5,1),each=3),col.axis=1:3,col.lab="green") > ternaryAxis(side=rep(1:3,3),at=1:9/10,labels=expression(9:1,4:1,7:3,3:2,1:1,2:3,3:7,1:4,1:9),pos=rep(c(0,0.5,1),each=3)) > > proc.time() user system elapsed 3.67 0.56 4.23