Odd error while trying to run ERGM in R - r

I have a network in R, formatted in pajek(.net) of collaborations. I'm trying to run an ergm analysis on it. I've formatted a similar network and run the same commands successfully, but when we expanded the size of the network, this error has begun to appear.
> CollabNet2005ERGM <-ergm(CollabNet05~edges+nodematch("11"))
Error in -object$glm$null.deviance : invalid argument to unary operator
Is there a workaround, either on the formatting side of things or within R that will allow me to complete the ERGM?

Related

RShiny : Error in paste0: Object not found

So, I'm currently converting my R script which runs just perfect into a RShiny app. The code is very long and I can't share it all but it involves forecasting various variables under different scenarios. While running it as an R code, I load equations from .Rdata file which has all equations & coefficients stored. However, when I;m trying to do it in Rshiny, it says object not found. Here eq_asset is the equation for asset variable I'm loading, pfw_test is a database. Error is Error in paste0: object 'z' not found which is coming from equation I'm loading because when I type equation (not load it), it runs just fine. I've tried loading equations .Rdata file in server, in UI etc but the same error shows up.

Is there a fix? Transfered ggplot fails with "Error in coord$backtransform_range(panel_params)..."

I tried to transfer some ggplots from my work computer to my home computer. I saved the plots as an .Rdata-file with the standard save function. I loaded the object with the load function at home. I get the following error:
"Error in coord$backtransform_range(panel_params) :
attempt to apply non-function"
I have no problems making new ggplots without getting the error. Neither when I save these plots locally and load them again. I've also tried transferring the plots both through gmail and with my cell phone as a storage unit. Both computers use Windows 10 operating system.
I get the error when I run the following bit of code
library(tidyverse)
load("Object.Rdata")
object$main_plot
I did not expect that this would cause an error. Am I missing something obvious?

cosinor2 package R error column 'Y' must be a 1d atomic vector or a list

I have been using cosinor2 for my summer project and the scripts have been working fine without any issues.
But when i transfer the files to my supervisors pc and try to run the package everything works other than for the graphs that gets produced through serial sectioning. It gives me error of
"column 'Y' must be a 1d atomic vector or a list ".
On my pc the graphs are produced without any issues but when i try to run the exact same script on my supervisor's pc I get the error.
Here is the script:
And here is the error:
The error was due to the incompatibility of the cosinor2 package with the ggplot2's newest update. I updated the cosinor2 package today and this error doesn't occur anymore.

Automatic Plotting in *.r file

I do have a *.r file where I order it to coduct a Chi Square of Independence and write it to an html file. It's working fine but I'd like to add a graph.
Doing by hand in R with linecommands works perfectly, but the exact same commands do not work in the *.r file but i want it to do it automatically.
mat1 <-matrix(c(12,3,2,12),nrow=2,byrow=T)
attach(mat1)
png('independence.png')
barplot(mat1,beside=TRUE)
dev.off()
Is there an additional command necessary?
kind regards
If you have an error in a script with no try or tryCatch, then entrie script fails. By trying to attach a matrix, you throw an error with the message:
Error in attach(mat1) :
'attach' only works for lists, data frames and environments
So you should pay more attention to the error messages in interactive mode, and if you are planning to use .r files for production you should learn to use error handling routines in R. The `attach function is a common source of new user errors, although this error is not particularly common. The more common errors with its use involve regression functions where the authors of the functions are expecting entire objects, usually dataframes, to be passed to a data argument.

Error using double-sided arrows in R

I am trying to run a Confirmatory Factor Analysis (part of the SEM package) in R but part of the syntax consists of using (<->) double-sided arrows. However, when I write "<->" in R, the program does not run and I get this: "Error: unexpected '>' in "amsex1<->" Thanks for your help!
library(SEM)
data<-read.csv("C:/Users/cgonzal6/Desktop/CYRUS/pilot-2-measurement13.csv")
factor<-data.frame(cbind(amsex1,amsex2))
cov.matrix<-cov(na.omit(factor))
cfa.model<-specifyModel()
EXTERNAL->amsex1,external0
Introjected -> amsex2, introjected0
amsex1<-> amsex1, error1
amsex2<-> amsex2, error2
The specifyModel() function reads the user input from the command line. It must be running in interactive mode to work. The <-> is not R syntax and should not be run as R code; that's just how specifyModel() wants' the model to be described in a text format. You can interpret everything after the specifyModel() to the next blank line as a big long character variable.
I assume you're trying to source() this script or run it from the command line? In a non-interactive mode, you can save the model specification in a file and read it with specifyModel(file="filename.txt"). That should also work in interactive mode as well.

Resources