user567879 user567879 - 3 months ago 20
R Question

Cant generate Hasse Diagram using R

I am getting error when the following code is run

data0_0 <- hasseDiagram::generateRandomData(15, 2, 0.0)
data0_5 <- hasseDiagram::generateRandomData(15, 2, 0.5)
data1_0 <- hasseDiagram::generateRandomData(15, 2, 1.0)
hasseDiagram::hasse(data0_0)
hasseDiagram::hasse(data0_5)
hasseDiagram::hasse(data1_0)


The error is

> source('~/test.r')
Error in .class1(object) : could not find function "graphAM"

Answer

I think the cause of your error is that you don't load and attach other packages that hasseDiagram depend on. If you have those packages, library("hasseDiagram") will solve your problem. (many of them aren't on the CRAN repository but you can get newest graph, BiocGenerics and Rgraphviz package via Bioconductor 3.3).

library("hasseDiagram")
data0_5 <- generateRandomData(15, 2, 0.5)
hasse(data0_5)

enter image description here

Comments