as.data.frame.psData: Converts an object of class 'psData' to a 'data.frame'

View source: R/as.data.frame.psData.R

as.data.frame.psDataR Documentation

Converts an object of class psData to a data.frame

Description

Converts an object of class psData—see readData—to a data.frame that can be used with in functions in other packages such as vglm to fit more complicated models.

Usage

## S3 method for class 'psData'
as.data.frame(x, ...)

Arguments

x

an object of class psData—see readDatafor more details.

...

any other arguments passed to data.frame.

Details

If x is a psData object of type "P", i.e. it relates to numbers of groups of glass, then a data.frame with a single variable count will be return where count = rep(x$data$n + 1, x$data$rn). The counts have one added to them because the zeta distribution requires that the counts are greater than or equal to one. If x is a psData object of type "P", i.e. it relates to group sizes, then a data.frame with a single variable count will be return where count = rep(x$data$n, x$data$rn).

Value

a data.frame with a single variable count. The number of rows in the data.frame is equal to sum(x$data$rn).

Examples

p = readData(system.file("extdata", "p.xlsx", package = "fitPS"))
p.df = as.data.frame(p)
table(p.df$count)
p$data

fitPS documentation built on June 24, 2024, 9:09 a.m.