I am using rstudio version 0.99.879 and the package igraph version 1.0.1. My question is closely related to this one on the same problem: igraph package in RStudio: Bipartite graph projection error
However, my question is more related to the data structure. Here is a link to an example of the csv.file that I use: https://workupload.com/file/6qhyZqc and the following code:
# Start
set.seed(7)
setwd("C:/Users/Stefan/Desktop/")
data <- read.csv("example.csv", sep=";")
summary(data)
library(igraph)
## using subset function to select 2 variables
data_new <- subset(data, select=c(justification, claimant_function))
data_new
g <- graph.data.frame(data_new, directed = FALSE)
g
col <- c("steelblue1", "white")
shape <- c("circle", "square")
# creating bipartite network
V(g)$type <- FALSE
V(g)$type[V(g)$name %in% data_new[, 1]] <- TRUE
is.bipartite(g)
# TRUE
plot(g, layout = layout.kamada.kawai,
vertex.shape = shape[as.numeric(V(g)$type) + 1],
vertex.color = col[as.numeric(V(g)$type) + 1],
edge.color = 'gray')
# bipartiate projection
one_mode_networks <- bipartite.projection(g)
# Error in .Call("R_igraph_bipartite_projection", graph, types,
# as.integer(probe1), :
# At bipartite.c:198 : Non-bipartite edge found in bipartite projection,
# Invalid value
Everything works out except the projection command. So,the code is not the problem. Perhaps the mistake/problem might be in the data itself. Since I am working with the data already quite a while, I think, I am professionally blinkered. It would be great if someone else could have a look at the posted example data and could give suggestions what the issue might be.
Any help is highly welcomed!