as.data.frame.classified: Convert output from classify() to...

View source: R/classify.R

as.data.frame.classifiedR Documentation

Convert output from classify() to matrix/data.frame/data.table

Description

Convert output from classify() to matrix/data.frame/data.table

Usage

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

## S3 method for class 'classified'
as.data.table(x, ...)

## S3 method for class 'classified'
as.matrix(x, ...)

Arguments

x

output from classify()

...

ignored

Value

data frame/data table with:

  • first column named as "id" column specified as input to classify() and with data from row.names(x)

  • all columns from classified

  • no row names

or simply the input matrix without additional attributes

See Also

Other classcodes: all_classcodes(), classcodes, codebook(), print.classcodes(), print.classified(), set_classcodes(), summary.classcodes(), visualize.classcodes()

Examples

x <- classify(c("C80", "I20", "unvalid_code"), "elixhauser")

as.matrix(x)[, 1:3]
as.data.frame(x)[, 1:3]
data.table::as.data.table(x)[, 1:3]

# `as_tibble()` works automatically due to internal use of `as.data.frame()`.
tibble::as_tibble(x)

eribul/coder documentation built on March 16, 2023, 12:50 a.m.