SPSubset: SPSubset

View source: R/SPSubset.R

SPSubsetR Documentation

SPSubset

Description

Function which compares two dataframes (the second with only a single row) column-wise, yielding a Boolean vector of equality between the two. Can be used to select a specific row out of the first (Data), which corresponds in some columns to the same columns in the second (ComparisonVector).

Usage

SPSubset(Data, ComparisonVector, by.Data, by.ComparisonVector = by.Data)

Arguments

Data

A dataframe containing the data you want to select a specific row from.

ComparisonVector

A dataframe with a single row which contains the indices used to select a row from dataframe Data.

by.Data

A character vector of column names of dataframe Data which shall serve as indices for row selection.

by.ComparisonVector

A character vector of column names of dataframe ColumnVector which shall serve as indices for row selection. Needs to have equal length as by.Data and defaults to by.Data.

Examples

Instead of writing, for example:
A[A$a==B$a & A$b==B$b & A$c==B$c & A$d==B$d,]
one can write
A[SPSubset(A,B,c("a","b","c","d")),]

stpalan/SPTools documentation built on Aug. 21, 2023, 11:21 a.m.