write_freqlist {mclm} | R Documentation |
Write a frequency list to a csv file
Description
This function writes an object of the class freqlist
to a csv file. The
resulting csv file contains two columns, the first being the type and the
second being the frequency of that type. The file also contains
a header line with the names of both columns.
Usage
write_freqlist(x, file, sep = "\t", make_config_file = TRUE, ...)
Arguments
x |
Object of class |
file |
Character vector of length 1. Path to the output file. |
sep |
Character vector of length 1. Column separator. |
make_config_file |
Logical. Whether or not a configuration file
needs to be created. In most circumstances, this should be set to |
... |
Additional arguments (not implemented). |
Details
write_freqlist
not only writes to the file file
,
but also creates a configuration file with a name that
is identical to file
, except that it has the filename extension
".yaml"
. The frequency list attributes "tot_n_tokens"
and "tot_n_types"
are stored to that configuration file.
Value
Invisibly, x
.
See Also
Other writing functions:
write_assoc()
,
write_conc()
,
write_fnames()
,
write_tokens()
,
write_txt()
,
write_types()
Examples
toy_corpus <- "Once upon a time there was a tiny toy corpus.
It consisted of three sentences. And it lived happily ever after."
freqs <- freqlist(toy_corpus, as_text = TRUE)
print(freqs, n = 1000)
write_freqlist(freqs, "example_freqlist.csv")
freqs2 <- read_freqlist("example_freqlist.csv")
print(freqs2, n = 1000)