Learn R Programming

GTbasedIM (version 1.0.0)

checking: checking Function: Check Specified Rows Within Dataset

Description

The checking function checks whether a given pair (Xdata.i.ell, Yell.i) is present in the dataset (Xdata, Ydata) and returns the corresponding indices, if any.

Usage

checking(Xdata, Ydata, Xdata.i.ell, Yell.i)

Value

A vector of indices where the match occurs.

Arguments

Xdata

Matrix. A dataset where rows represent observations and columns represent features.

Ydata

Vector. The response variable associated with each row in Xdata.

Xdata.i.ell

Vector. A vector of feature values, potentially representing a row of Xdata.

Yell.i

Integer. The specific response value to check.

Examples

Run this code
# Example usage from Example 5.2 in Davila-Pena et al. (2024):

library(CoopGame)
n.user <- 16
Xdata <- createBitMatrix(4)[,-5]
Xdata <- rbind(c(0,0,0,0),Xdata)
Ydata <- rep(0,n.user)
Ydata[1+c(10,11,13,14,15)] <- 1

Xdata.i.ell <- c(1,2,0,1) # obviously, considering `Xdata` is binary, this cannot be present.
Yell.i <- 1

checking(Xdata, Ydata, Xdata.i.ell, Yell.i)

Xdata.i.ell <- c(1,1,0,1)
Yell.i <- 0

checking(Xdata, Ydata, Xdata.i.ell, Yell.i)


Run the code above in your browser using DataLab