as_data_frame {mclm} | R Documentation |
Coerce object to a data frame
Description
as_data_frame()
is an alternative to as.data.frame()
. A number of objects
in mclm can be turned into dataframes with one of these functions.
Usage
as_data_frame(x, row.names = NULL, optional = FALSE, ...)
## Default S3 method:
as_data_frame(x, row.names = NULL, optional = FALSE, ...)
## S3 method for class 'assoc_scores'
as.data.frame(x, ...)
## S3 method for class 'conc'
as.data.frame(x, ...)
## S3 method for class 'fnames'
as.data.frame(x, ...)
## S3 method for class 'freqlist'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S3 method for class 'details.slma'
as.data.frame(x, ...)
## S3 method for class 'slma'
as.data.frame(x, ...)
## S3 method for class 'tokens'
as.data.frame(x, ...)
## S3 method for class 'types'
as.data.frame(x, ...)
Arguments
x |
Object to coerce to data.frame. |
row.names |
|
optional |
Logical. If |
... |
Additional arguments |
Value
Object of class data.frame
Examples
# for an assoc_scores object ---------------------
a <- c(10, 30, 15, 1)
b <- c(200, 1000, 5000, 300)
c <- c(100, 14, 16, 4)
d <- c(300, 5000, 10000, 6000)
types <- c("four", "fictitious", "toy", "examples")
(scores <- assoc_abcd(a, b, c, d, types = types))
as.data.frame(scores)
as_data_frame(scores)
# for a conc object ------------------------------
(conc_data <- conc('A very small corpus.', '\\w+', as_text = TRUE))
as.data.frame(conc_data)
# for an fnames object ---------------------------
cwd_fnames <- as_fnames(c('file1', 'file2'))
as.data.frame(cwd_fnames)
# for a freqlist, types or tokens object ---------
toy_corpus <- "Once upon a time there was a tiny toy corpus.
It consisted of three sentences. And it lived happily ever after."
(flist <- freqlist(toy_corpus, as_text = TRUE))
as.data.frame(flist)
(flist2 <- keep_re(flist, "^..?$"))
as.data.frame
(toks <- tokenize(toy_corpus))
as.data.frame(toks)
(toks <- tokenize(toy_corpus))
as.data.frame(toks)
[Package mclm version 0.2.7 Index]