read_freqlist | R Documentation |
This function reads an object of the class freqlist
from a csv file. The csv
file is assumed to contain two columns, the first being the type and the
second being the frequency of that type. The file is also assumed to
have a header line with the names of both columns.
read_freqlist(file, sep = "\t", file_encoding = "UTF-8", ...)
file |
Character vector of length 1. Path to the input file. |
sep |
Character vector of length 1. Column separator. |
file_encoding |
File encoding used in the input file. |
... |
Additional arguments (not implemented). |
read_freqlist
not only reads the file file
,
but also checks whether a configuration file exists with a name that
is identical to file
, except that it has the filename extension
".yaml"
.
If such a file exists, then that configuration file
is taken to 'belong' to file
and is also read and the frequency list attributes
"tot_n_tokens"
and "tot_n_types"
are retrieved from it.
If no such configuration file exists,
then the values for "tot_n_tokens"
and "tot_n_types"
are
calculated on the basis of the frequencies in the frequency list.
Object of class freqlist
.
write_freqlist()
Other reading functions:
read_assoc()
,
read_conc()
,
read_fnames()
,
read_tokens()
,
read_txt()
,
read_types()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.