SPSubset | R Documentation |
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).
SPSubset(Data, ComparisonVector, by.Data, by.ComparisonVector = by.Data)
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. |
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")),]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.