data("mtcars") # load base R example dataset
# overall means and SDs table for disp (Displacement) and hp (Gross horsepower)
table_neat(list(aggr_neat(mtcars, disp),
aggr_neat(mtcars, hp)))
# means and SDs table for mpg (Miles/(US) gallon), wt (Weight), and hp (Gross horsepower)
# grouped by cyl (Number of cylinders)
# each measure rounded to respective optimal number of digits
# wt renamed to weight (for the column title)
table_neat(list(
aggr_neat(mtcars, mpg, round_to = 1),
aggr_neat(mtcars, wt, new_name = 'weight', round_to = 2),
aggr_neat(mtcars, hp, round_to = 0)
),
group_by = 'cyl')
# same as above, but with medians, and with groups per columns
table_neat(
list(
aggr_neat(mtcars, mpg, round_to = 1),
aggr_neat(mtcars, wt, new_name = 'weight', round_to = 2),
aggr_neat(mtcars, hp, round_to = 0)
),
group_by = 'cyl',
method = 'median+sd',
group_per = 'columns'
)
# an extensive example to show how to collect and aggregate raw data is
# available via the README file at the repository:
# https://github.com/gasparl/neatstats
Run the code above in your browser using DataLab