Description Usage Arguments Value Author(s) See Also Examples
convert a sparse tensor (e.g. created using getTensor
) to set of triples.
1 | tnsr2trp(tnsr)
|
tnsr |
a sparse tensor (e.g. created using |
a matrix of three columns containing the triples
Abdelmoneim Amer Desouki
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | trp=rbind(
cbind('Alex', 'loves', 'Don'),
cbind('Alex', 'loves', 'Elly'),
cbind('Alex', 'hates', 'Bob'),
cbind('Don', 'loves', 'Alex'),
cbind('Don', 'hates', 'Chris'),
cbind('Chris', 'hates', 'Bob'),
cbind('Bob', 'hates', 'Chris'),
cbind('Elly', 'hates', 'Chris'),
cbind('Elly', 'hates', 'Bob'),
cbind('Elly', 'loves', 'Alex')
)
######
# form tensor as a set of frontal slices (Predicate mode)
tnsr=getTensor(trp)
trp_=tnsr2trp(tnsr)
#print(any(! paste(trp_[,1],trp_[,2],trp_[,3]) %in% paste(trp[,1],trp[,2],trp[,3])))
#print(any(! paste(trp[,1],trp[,2],trp[,3]) %in% paste(trp_[,1],trp_[,2],trp_[,3])))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.