[R-es] pregunta

eric ericconchamunoz en gmail.com
Mar Oct 27 22:45:43 CET 2015


tambien te sirve la funcion data.table ... si no tienes instalado el 
paquete:

install.packages("data.table")
library(data.table)
jbe <- as.data.table(read.table("tusdatos.txt"))
jbe.ave <- jbe[, .("ave"=mean(Gain)), by=.(Diet)]

 > jbe.ave
    Diet ave
1:   d1 280
2:   d2 278
3:   d3 312


Saludos.

Eric.


On 10/27/2015 05:16 PM, jbetancourt wrote:
>
> Estimados
>
> Cuando existia epicalc,  hab�a una  manera muy f�cil de determinar la media de una variable (en esta caso Gain)  por grupos, en este caso (Diet). ?Como se puede hacer ahora?
>
>        Diet Gain
> 1    d1  270
> 2    d1  300
> 3    d1  280
> 4    d1  280
> 5    d1  270
> 6    d2  290
> 7    d2  250
> 8    d2  280
> 9    d2  290
> 10   d2  280
> 11   d3  290
> 12   d3  340
> 13   d3  330
> 14   d3  300
> 15   d3  300
>
> Saludos
> Jos�
>
> 	[[alternative HTML version deleted]]
>
>
>
> _______________________________________________
> R-help-es mailing list
> R-help-es en r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>

-- 
Forest Engineer
Master in Environmental and Natural Resource Economics
Ph.D. student in Sciences of Natural Resources at La Frontera University
Member in AguaDeTemu2030, citizen movement for Temuco with green city 
standards for living

Nota: Las tildes se han omitido para asegurar compatibilidad con algunos 
lectores de correo.



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