read_test_data {MetaNLP}R Documentation

Read and adapt test data

Description

This function takes a MetaNLP object (the training data) and the test data csv. The function creates the word count matrix from the test data and matches the columns of the given training MetaNLP object with the columns of the test word count matrix. This means that columns, which do appear in the test word count matrix but not in the training word count matrix are removed; columns that appear in the training word count matrix but not in the test word count matrix are added as a column consisting of zeros.

Usage

read_test_data(object, ...)

## S4 method for signature 'MetaNLP'
read_test_data(object, file, ...)

Arguments

object

The MetaNLP object created from the training data.

...

Further arguments to MetaNLP.

file

Either the path to the test data csv, the data frame containing the papers or a MetaNLP object

Value

An object of class MetaNLP

Examples

path_train <- system.file("extdata", "test_data.csv", package = "MetaNLP", mustWork = TRUE)
path_test <- system.file("extdata", "test_data_changed.csv", package = "MetaNLP", mustWork = TRUE)
obj_train <- MetaNLP(path_train)
obj_test <- MetaNLP(path_test)
to_test_obj <- read_test_data(obj_train, obj_test)


[Package MetaNLP version 0.1.2 Index]