Error in if (dim(input)[1] == dim(input)[2]) { : argument is of length zero

I apologize for the probably very obvious error - I am quite new to R. I am running bridge centrality and receive this error, and haven't had luck searching online. Any advice would be much appreciated.

prcdcu <- read_sav("prcdcu.sav")[c(1:6, 7:18)]
dim(prcdcu)
head(prcdcu)
prcdcu_cor <- estimateNetwork(prcdcu, default = c("cor"))
prcdcu_cor
community_structure <- c(rep("cd", 6), rep("cu", 12))
community_structure
plot(prcdcu_cor, groups = community_structure, layout = "spring", color = c("white", "dark grey"), vsize = 5)
bridge_centrality <- bridge(prcdcu_cor, communities = community_structure)

Error in if (dim(input)[1] == dim(input)[2]) { :
argument is of length zero

This is telling you that if isn't seeing anything with dim(input)[1] == dim(input)[2]) as its argument. Since there's no if statement in the snippet, check the function signature the most recent function, bridge to see what it's argument should be. It's possible that prcdu_cor and community_structure could be misaligned.

For better help, include a reprex.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.