4

I'm completely new to R. I'm working in Social network analysis and want to visualize a network plot. I installed various packages like igraph, ggplot2, tcltk etc.. I have a code as follows:

network <- as.matrix(x)
g1 <- graph.adjacency(network)
tkplot(g1)

When I run this code, i got following error:

Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"), class = "tclObj") : 
  [tcl] invalid command name "font".

I tried searching for the answer but could not clearly understand how to resolve it. Can somebody please help me to resolve this error?

I'm using R on a server through RStudio.

Gago-Silva
  • 1,873
  • 4
  • 22
  • 46
N D Thokare
  • 1,703
  • 6
  • 35
  • 57

3 Answers3

0

It runs without any problem for me. Did you installed and load all libraries needed? tcltk and igraph ?

install.packages("tcltk")
library(igraph)
x<-read.table("http://www.ats.ucla.edu/stat/r/faq/mat25.txt", header=FALSE)
network = as.matrix(x)
g1 = graph.adjacency(network)
tkplot(g1)
Gago-Silva
  • 1,873
  • 4
  • 22
  • 46
  • yes,.. I have installed and loaded all libraries needed as mentioned in question. Still the error is occurring. As per my survey, it's something to do with "font" over there.. but I could not understand what to do about it? – N D Thokare Dec 04 '12 at 09:47
0

Which version of tcltk you have installed? Because the font command doesn't come in until tk 8.0 here. Install the newest version and check weather the code works.

manjovial
  • 105
  • 2
  • 8
0

FYI - I've received the same error and simply needed to logoff from my mac & logon again, after having installed XQuartz (which is required by the package tcltk.