write_csv {MetaNLP}R Documentation

Save the word count matrix

Description

This function can be used to save the word count matrix of a MetaNLP object as a csv-file.

Usage

write_csv(object, ...)

## S4 method for signature 'MetaNLP'
write_csv(object, path, type = c("train", "test"), ...)

Arguments

object

An object of class MetaNLP.

...

Additional arguments for write.table, e.g. encoding as UTF-8.

path

Path where to save the csv.

type

Specifies if the word count matrix should be saved as "train_wcm.csv" or "test_wcm.csv". If the user wants to use another file name, the whole path including the file name should be given as the path argument

Details

If a path to a specific folder is given (but the path name does not end with ".csv"), the file is saved in this folder as "train_wcm.csv" or "test_wcm.csv". By providing a path ending with ".csv", the user can override the default naming convention and the file is saved according to this path.

Value

nothing

Examples

path <- system.file("extdata", "test_data.csv", package = "MetaNLP", mustWork = TRUE)
obj <- MetaNLP(path)
obj2 <- delete_stop_words(obj)
write_path <- tempdir()
write_csv(obj2, path = write_path)
file.remove(file.path(write_path, "train_wcm.csv"))


[Package MetaNLP version 0.1.2 Index]