Learn R Programming

RnavGraph (version 0.1.8)

scagEdgeWeights: Create a from-to edge matrix with the scagnostic weights

Description

Create a from-to edge matrix with the scagnostic weights.

Usage

scagEdgeWeights(data, scags = c("Clumpy", "NotClumpy", "Monotonic", "NotMonotonic", "Convex", "NotConvex", "Stringy", "NotStringy", "Skinny", "NotSkinny", "Outlying","NotOutlying", "Sparse", "NotSparse", "Striated", "NotStriated", "Skewed", "NotSkewed"), combineFn = NULL)

Arguments

data
object to calculate scagnostics on: NG_data, a vector, a matrix or a data.frame.
scags
Single element or a subset of (with possible a "Not" preceding): "Outlying", "Skewed", "Clumpy", "Sparse", "Striated", "Convex", "Skinny", "Stringy", "Monotonic"
combineFn
Must be a function that takes in a vector of length scags and returns a single value. This return value comprises the new weights of the nodes get selected from.

Value

a named list with fromToEdgeMatrix being a matrix and nodeNames being a vector.

See Also

navGraph, scagNav, scagGraph

Examples

Run this code
data(olive)
ng.olive <- ng_data(name = "Olive",
		data = olive[,-c(1,2)],
		shortnames = c("p1","p2","s","ol","l1","l2","a","e"),
		group = as.numeric(olive$Area)+1
)

edgeWts <- scagEdgeWeights(data = ng.olive,
		scags = c("Clumpy", "Skinny"),
		combineFn = max)
edgeWts$fromToEdgeMatrix[1:3,]


edgeWts <- scagEdgeWeights(data = ng.olive,
		scags = c("Clumpy", "Skinny"),
		combineFn = function(x){
			2*x[1]+3*x[2]
		})
edgeWts$fromToEdgeMatrix[1:3,]

Run the code above in your browser using DataLab