It seems like the summary
command in R is coming up blank whenever I run it in a script, even though it works fine in the command line.
Here's my script:
suppressMessages(library("statnet"))
#Simple example using a 3-node network
n<-network.initialize(3, directed=T) #generate an empty 3 node network
n[1,2]<-1 #assign a single link between node 1 and node 2
gplot(n) #plot the network
e1<-ergm(n~edges) #conduct an ergm using only the edges term
summary(e1)
And no, removing suppressMessages
doesn't help.
The result of this script is this:
root@user:~/NetworkStatsData$ r test.R
Evaluating log-likelihood at the estimate.
That's it. Absolutely nothing from the summary
command. Now, when I run the exact same commands in command line, I get this result:
root@user:~/NetworkStatsData$ R
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> suppressMessages(library("statnet"))
> n<-network.initialize(3, directed=T)
> n[1,2]<-1
> gplot(n)
> e1<-ergm(n~edges)
Evaluating log-likelihood at the estimate.
> summary(e1)
==========================
Summary of model fit
==========================
Formula: n ~ edges
Iterations: 4 out of 20
Monte Carlo MLE Results:
Estimate Std. Error MCMC % p-value
edges -1.609 1.095 0 0.202
Null Deviance: 8.318 on 6 degrees of freedom
Residual Deviance: 5.407 on 5 degrees of freedom
AIC: 7.407 BIC: 7.198 (Smaller is better.)
>
Which is what I want to happen when running the script. Why is it acting differently for one than the other?