Learn R Programming

MadanText (version 0.1.0)

f5: 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)

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.

Arguments

UPIP

A data frame with a column named 'doc_id'.

I

An integer representing the document ID.

Examples

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

Run the code above in your browser using DataLab