read_freqs | R Documentation |
Convenience wrapper to import typical output from CWB tools. The expected file format is tab delimited, only containing data, no quotes, missing values, comments or header.
read_freqs( file, header = FALSE, cols = list(0L, ""), sep = "\t", comment.char = "", na.strings = "", quote = "", allowEscapes = FALSE, nlines = sh_count_lines(file), ... ) write_freqs(..., sep = "\t", quote = FALSE, na = "") fread_freqs( ..., header = FALSE, sep = "\t", quote = "", na.strings = NULL, stringsAsFactors = FALSE ) fwrite_freqs(..., sep = "\t", sep2 = " ", quote = FALSE)
header |
logical. whether or not the first line should be used as column
names. Note: |
cols |
list. a list with column types (e.g. |
sep |
character. |
comment.char |
character. |
na.strings |
character. |
quote |
character. |
nlines |
integer. number of lines in file, see |
... |
further arguments to be passed to |
.x |
character. path to file or connection, see |
skip |
integer. how many lines to skip, see |
These are convenience wrappers around scan
or fread
with sane
defaults for common frequency list formats.
In read_freqs
, wc -l
is run if available to pass the line number to scan
This reduces memory overhead substantially and can also be a bit faster.
data.frame or data.table
scan(), fread()
## Not run: path <- "brown_word_per_id.txt" out <- read_freqs(path, list(f = 0L, type = "", text_id = "")) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.