read_test_data: Read and adapt test data

read_test_dataR Documentation

Read and adapt test data

Description

This function takes a MetaNLP object (the training data) and the test data. The function creates the document-term matrix from the test data and matches the columns of the given training MetaNLP object with the columns of the test document-term matrix. This means that columns, which do appear in the test document-term matrix but not in the training document-term matrix are removed; columns that appear in the training document-term matrix but not in the test document-term 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)


MetaNLP documentation built on April 4, 2025, 5:11 a.m.