vector.namesmatch: reorder vector v into order determined by matching the names...

Description Usage Arguments Details Value Note Examples

View source: R/misc.utilities.R

Description

A helper function to reorder vector v (if named) into order specified by matching its names to the argument names

Usage

1
vector.namesmatch(v, names, errname = NULL)

Arguments

v

a vector (or list) with named elements, to be reorderd

names

a character vector of element names, corresponding to names of v, specificying desired orering of v

errname

optional, name to be reported in any error messages. default to deparse(substitute(v))

Details

does some checking of appropriateness of arguments, and reorders v by matching its names to character vector names

Value

returns v, with elements reordered

Note

earlier versions of this function did not order as advertiased

Examples

1
2
test<-list(c=1,b=2,a=3)
vector.namesmatch(test,names=c('a','c','b'))

statnet.common documentation built on May 19, 2017, 4:17 p.m.

Search within the statnet.common package
Search all R packages, documentation and source code