Learn R Programming

mclm (version 0.2.7)

read_assoc: Read association scores from file

Description

This function reads a file written by write_assoc().

Usage

read_assoc(file, sep = "\t", file_encoding = "UTF-8", ...)

Value

An object of class assoc_scores.

Arguments

file

Path of the input file.

sep

Field separator in the input file.

file_encoding

Encoding of the input file.

...

Additional arguments.

See Also

write_assoc()

Other reading functions: read_conc(), read_fnames(), read_freqlist(), read_tokens(), read_txt(), read_types()

Examples

Run this code
txt1 <- "we're just two lost souls swimming in a fish bowl,
year after year, running over the same old ground,
what have we found? the same old fears.
wish you were here."
flist1 <- freqlist(txt1, as_text = TRUE)
txt2 <- "picture yourself in a boat on a river
with tangerine dreams and marmelade skies
somebody calls you, you answer quite slowly
a girl with kaleidoscope eyes"
flist2 <- freqlist(txt2, as_text = TRUE)
(scores <- assoc_scores(flist1, flist2, min_freq = 0))
.old_wd <- setwd(tempdir())
write_assoc(scores, "example_scores.tab")
(scores2 <- read_assoc("example_scores.tab"))
setwd(.old_wd)

Run the code above in your browser using DataLab