xtable - Table with function in R -


Do I need to do some descriptive statistics on datasets I I need to make a table from a dataset which gives me, Meaning of any other variable for each variable.

  City means (age) 1 14 2 15 3 23 4 34   

What is the fastest way to do this?

I do whatever it is the same thing, but on two dimensions:

  mean (age) Male Female City 1 12 13 2 15 16 3 21 22 4 34 33   

and I wonder if there is more likely to apply to other functions, minimum, yoga ....

edit: I instances adds a dataset to simplify am:

  data.frame (year = representatives (c (12,13, 14,15,15,16,34,67,45,78, 17,42), 2), gender = representative (c ("m", "f"), 12), city = representative (c (1, 2,3,4,4,3,2,1), 3 ))    

dcast on large data sets> Detatabl package can be added a)

  library (data only) means library (Reshape2)) Dcastkdataktable (Setditi (DTO), city ~ gender, Mankvr = "old" fun =) # City FM # 1: 1 41.33333 24.0 0000 # 2: 2 35.66667 21.66667 # 3: 3 35.66667 21.66667 # 4: 4 41.33333 24.00000   

You can make regular data.table can also be used to mean ## city sex meaning # 1: 1f / set (set) (set) (set) (date = mean (year)), = su By (city, gender)] # 41.33333 # 2: 1m 24.00000 # 3: 2f35.66667 # 4: 2m21.66667 # 5: 3f35.66667 # 6: 3m21.66667 # 7: 4f41.33333 # 8: 4 M 24.00000

or dplyr package (very fast)

  library (dplyr) dato% & gt;% group_by (city) , Gender)% & gt;% Summary Mean (Year)) # City Sex Means (Years) # 1 F 41.33333 # 2 1 M 24.00000 # 3 2 F 35.66667 # 4 2 M 21.66667 # 5 3 F 35.66667 # 6 3 M21.66667 # 7 4F 41.33333 # 8 4 M 24.00000    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -