Learn R Programming

taRifx (version 1.0.6.2)

as.data.frame.by: Convert the results of by() to a data.frame.

Description

Converts the results of by() to a data.frame if possible, (reducing dimensionality and adding repetition as necessary)

Usage

# S3 method for by
as.data.frame (x, row.names = NULL,
    optional = FALSE,
    colnames = paste("IDX", seq(length(dim(x))), sep = ""),
    na.rm = TRUE, ...)

Arguments

x

The by object

row.names

Names of the rows. If NULL, function tries guessing them

optional

Ignored.

colnames

Names of columns

na.rm

Remove NAs or not.

Pass-alongs.

Value

A data.frame.

Examples

Run this code
# NOT RUN {
test.by <- by( ChickWeight$weight, ChickWeight$Diet, mean)
	test.by
	class(test.by)
	str(test.by)
	test.df <-as.data.frame(test.by)
	str(test.df)
# }

Run the code above in your browser using DataLab