0

I'm getting two unexpected errors for tnet functions in R. My edgelist:

Person    Event
1 a

2 b

3 c

edgelist <- as.matrix("file.csv")
edgelist_in_igraph <- graph.edgelist(edgelist)
edgelist_in_tnet <- as.tnet(edgeist_in_igraph)

cluster_coefficients <- clustering_local_tm(edgelist_in_tnet)

> error: "max not meaningful for factors"

And if I try to make it one mode:

onemode <- projecting_tm(tnet, method="Newman") 

>error: "arguments must have same length"

Any ideas? If anyone here has used tnet before, any example would be super helpful.

agstudy
  • 119,832
  • 17
  • 199
  • 261
Olga Mu
  • 908
  • 2
  • 12
  • 23

1 Answers1

0

Maybe this is a misunderstanding, but

edgelist <- as.matrix("file.csv")

does not make sense. as.matrix converts an R object to a matrix, it cannot read data from files. I think what you wanted was probably

edgelist <- read.csv("file.csv")

and then

edgelist_in_igraph <- graph.data.frame(edgelist)
Gabor Csardi
  • 10,705
  • 1
  • 36
  • 53