[R-es] Excel vs. R

daniel daniel319 en gmail.com
Mar Sep 22 22:01:40 CEST 2015


Agrupando tus datos y sin necesidad de ninguna librería puedes hacer algo
como esto que creo te puede servir también.

http://stats.stackexchange.com/questions/14118/drawing-multiple-barplots-on-a-graph-in-r

mydata <- data.frame(Barplot1=rbinom(5,16,0.6), Barplot2=rbinom(5,16,0.25),
                     Barplot3=rbinom(5,5,0.25), Barplot4=rbinom(5,16,0.7))
barplot(as.matrix(mydata), main="Interesting", ylab="Total", beside=TRUE,
        col=terrain.colors(5))
legend(13, 12, c("Label1","Label2","Label3","Label4","Label5"), cex=0.6,
       fill=terrain.colors(5))


Daniel Merino

El 22 de septiembre de 2015, 16:48, pepeceb <pepeceb en yahoo.es> escribió:

> Mira esto sobre los Bar Plots
>
> Quick-R: Bar Plots <http://www.statmethods.net/graphs/bar.html>
>
>
> [image: image] <http://www.statmethods.net/graphs/bar.html>
>
>
>
>
>
> Quick-R: Bar Plots <http://www.statmethods.net/graphs/bar.html>
> Bar Plots Create barplots with the barplot(height) function, where height
> is a vector or matrix. If height is a vector, the values determine the
> heights of the bar...
> Ver en www.statmethods.net <http://www.statmethods.net/graphs/bar.html>
> Vista previa por Yahoo
>
>
>
>
> Si lo que quieres es dividir por intervalos puedes hacer algo así, a ver
> si te sirve.
> Sea z1 tu matriz:
>
> z1$rango <- (cut(z1$tamaño, breaks =3, dig.lab=2)) #Añadimos una variable
> rango con 3 divisiones del rango de tamaños. Te pone los intervalos por
> defecto pero tambien puedes tu ponerlos tu.
>
> table (z1$estaciones,z1$rango) #una tablita con el numero de estaciones
> por rango y tamaño
> #Grafica de barras
> barplot(table(z1$estaciones,z1$rango))# pero la mejoramos un poco
>
> #creamos una leyenda
> leyenda<-c( "Gualeguycito", "(Itapebí]","(Cañada]")
>
> barplot (table (z1$tamaño,z1$rango),
> main= "Promedio de tamaños...", ylab="Tamaño",
>
> beside = T, legend.text=leyenda,args.legend=list(x="topleft"))
>
> Saludos
>
>
>
> El Martes 22 de septiembre de 2015 21:20, Susana deus alvarez <
> susanadeus.deusalvarez en gmail.com> escribió:
>
>
> Hola, escribo porque tengo una gran duda como gráficas tan fáciles en
> Excel son tan difíciles en R?
> No consigo hacer una gráfica en R de estas características. Osea como
> puedo dividir por sitios por tamaños. En una planilla enorme tengo la
> primera columna son las estaciones (pero solo quiero las tres ultimas) y
> después muchos parámetros, en las columnas 46, 53 y 60 los promedios
> ponderados. Y no puedo hacerlo en R incapaz. He intentado crear unos excel
> más pequeño solo con eso pero no hay manera. Si alguien me puede ayudar un
> poco...
>
> Gracias
>
> [image: Imágenes integradas 1]
>
> _______________________________________________
> R-help-es mailing list
> R-help-es en r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
>
> _______________________________________________
> R-help-es mailing list
> R-help-es en r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
>


-- 
Daniel
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20150922/2f531869/attachment-0001.html>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 50815 bytes
Desc: no disponible
URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20150922/2f531869/attachment-0001.png>


Más información sobre la lista de distribución R-help-es