SachaEpskamp / qgraph

Developmental version of qgraph
GNU General Public License v2.0
68 stars 21 forks source link

[error] qgraph destroys base summary function for characters #9

Closed huelf closed 5 years ago

huelf commented 7 years ago

Hi, after loading package qgraph the base summary function does no longer work properly. It outputs all characters of class character instead of only 5.

Example:

iris2 <- iris
iris2$char <- as.character(iris$Petal.Width)
summary(iris2)
library(qgraph)
summary(iris2)

R Version 3.4.1 qgraph Version 1.4.3

Regards Hans

mrkwht commented 5 years ago

I'm having the same issue. The problem appears to be due to the network package, which seems to be invoked when using qgraph, regardless if qgraph is loaded or the namespace is invoked.

In code below, the summary function works correctly. Then after defining a function based on function in qgraph namespace, the summary function breaks. Debug shows that this is due to the fact that summary.character is now being invoked (note that calling the debug function makes R start using the network::summary.character too). It's not clear whether qgraph can fix this problem without addressing the issues in the network package.

summary(data.frame(letters[1:5],stringsAsFactors=F))
cor_auto <- qgraph::cor_auto
summary(data.frame(letters[1:5],stringsAsFactors=F))
debugonce(network::summary.character)
summary(data.frame(letters[1:5],stringsAsFactors=F))

R Version: 3.5.0 qgraph version 1.5

SachaEpskamp commented 5 years ago

Thanks for reporting. I removed the sna dependency that caused this!