Topic: Utilities

Topic Description:

Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.



File: utilities/utilities.r

View File Source Download File No help file available

Function: match.dataframe

Function Description: match.dataframe

Matches two dataframes using two or more columns. R's function match() works only on vectors (and thus single columns only). The return is a vector of indices, exactly as match() does.

Function Arguments:

ArgumentDefault Value
x
y

Function Source:

match.dataframe=function(x,y)
{
for(i in 1:dim(x)[2]) x[,i]=as.character(x[,i])
for(i in 1:dim(y)[2]) y[,i]=as.character(y[,i])

xrow=t(apply(x,1,paste,collapse='-'))
yrow=t(apply(y,1,paste,collapse='-'))

return(match(xrow,yrow))
}