f5 {MadanTextNetwork}R Documentation

Filter Data Frame by Document ID

Description

This function filters a data frame by the specified document ID. If the ID is 0, the entire data frame is returned.

Usage

f5(UPIP, I)

Arguments

UPIP

A data frame with a column named 'doc_id'.

I

An integer representing the document ID.

Value

Returns a subset of the input data frame ('UPIP') containing only the rows where the 'doc_id' column matches the specified document ID 'I'. If 'I' is 0, the function returns the entire data frame unmodified. The output is a data frame with the same structure as the input but potentially fewer rows, depending on the presence and frequency of the specified ID.

Examples

data <- data.frame(doc_id = 1:5, text = letters[1:5])
filtered_data <- f5(data, 2)

[Package MadanTextNetwork version 0.1.0 Index]