Learn R Programming

statnet.common (version 4.13.0)

vector.namesmatch: reorder vector v into order determined by matching the names of its elements to a vector of names

Description

This function is deprecated in favor of match_names() and will be removed in a future release.

Usage

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

Value

returns v, with elements reordered

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))

Examples

Run this code

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

Run the code above in your browser using DataLab