R: Plots and graphs

Plotting in R is extremely easy.

plot (1:21)

rstudio_plotting_000

plot (1:8, main="TESTING",xlab="x",ylab="y")

rstudio_plotting_001

points(c(1,5),c(4,2), col="green")

rstudio_plotting_002

abline(h=3,col="red",lty=2)

rstudio_plotting_003

abline(h=1,col="yellow",lty=2)

rstudio_plotting_004

grid(col="purple")

rstudio_plotting_005

hist (1:21,col="orange")

rstudio_plotting_006

lines(c(2,4),c(5,3),col="blue")

rstudio_plotting_007

abline(h=3,col="red",lty=2)

Exporting and importing graphs

dev.copy(png,'myplot.png')
dev.off()

To list existing colors

> colors()
  [1] "white"                "aliceblue"            "antiquewhite"         "antiquewhite1"       
  [5] "antiquewhite2"        "antiquewhite3"        "antiquewhite4"        "aquamarine"          
  [9] "aquamarine1"          "aquamarine2"          "aquamarine3"          "aquamarine4"         
 [13] "azure"                "azure1"               "azure2"               "azure3"              
(...)
"violetred2"           "violetred3"          
[645] "violetred4"           "wheat"                "wheat1"               "wheat2"              
[649] "wheat3"               "wheat4"               "whitesmoke"           "yellow"              
[653] "yellow1"              "yellow2"              "yellow3"              "yellow4"             
[657] "yellowgreen"

Global changes for styles and colors

Adding texts to plots

text(11,11,"Regular text")

text(11,11, "Bigger text", cex=2)

text(5,5, "serif text", family="serif")

text(3,3 "mono text", family="mono")

text(7,7 "Sans text", family="sans")

 

Mathematic notation

demo(plotmath)

draw.plotmath.cell(expression(x != y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x < y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x <= y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x > y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x >= y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x %~~% y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x %=~% y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x %==% y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x %prop% y), i, nr); i <- i + 1

> draw.plotmath.cell(expression(x %~% y), i, nr); i <- i + 1

 

CentOS: Uso común de yum

Configurar proxy en yum

En el fichero  /etc/yum.conf se añade la línea:

proxy=http://proxy.organizacion.com:80
Ver repositorios de yum que tenemos configurados

En consola de bash
yum repolist

Añadir un repositorio a yum

El ejemplo lo vamos a hacer con repoforge. Es posible que haya versiones más modernas que rpmforge:

wget http://tree.repoforge.org/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

Borrar un repositorio de yum y cambiarlo por otro más moderno

rpm -e rpmforge-release-0.5.2-2.el5.rf.x86_64
wget http://tree.repoforge.org/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm

Actualizar todos los comandos a la vez por línea de comandos en yum:

Actualizar todos los paquetes de CentOS. Recomendamos seriamente que se haga un backup previo a hacer este paso:

yum update
yum upgrade -y
yum clean all
yum --obsoletes update


Ver paquetes instalados

yum list installed