ch.summariseBy: A function to summarize a dataframe one grouping variable

View source: R/ch.summariseBy.r

ch.summariseByR Documentation

A function to summarize a dataframe one grouping variable

Description

This function summarizes a dataframe by one grouping variable. It is easier to call than ddply within a function.

Usage

ch.summariseBy(data, grpCol, dvCol, newCol, FUN)

Arguments

data

a dataframe.

grpCol

a string specifying the name of the column in the dataframe containing the grouping variable.

dvCol

a string specifying the name of the column in the dataframe containing the variable you want to summarize.

newCol

a string specifying the name of the new column to be created that contains the summarized data.

FUN

the summarizing function (e.g., mean).

Value

a dataframe

Examples

ch.summariseBy (df, "sn", "RT", mean)

ccpluncw/ccpl_R_chutils documentation built on Nov. 22, 2024, 5:18 a.m.