Closed Drake14 closed 6 months ago
Hi @Drake14 ! Can you print out the object 'PhxArrestNet2023'? Just enter the object name and make sure it returns it.
Hi @Drake14! Run this block of code and see if the plot works:
# set the url
loc <- "https://github.com/jacobtnyoung/sna-textbook/raw/main/data/data-PHX-arrest-2023-net.rds"
# for the 2023
PhxArrestNet2023 <- readRDS( url( loc ) )
library( sna )
gplot(
PhxArrestNet2023,
gmode = "twomode"
)
If this works for you, then you might have a command that is removing the object somewhere.
Hi! I just attempted to print out the 2023 network and tried that code block as well.
When trying to print an output PhxArrestNet2023, I do not get an error code, but it does not display any results. I also set echo = TRUE to debug just in case, but there is no output after calling for PhxArrestNet2023.
After trying the code block, this is the new error I am getting: Error: ! object 'PhxArrestNet2023' not found Backtrace:
Hi @Drake14! Try running it directly in RStudio, not from the .Rmd file. I would close RStudio, reopen it, and then copy and paste this piece directly into the command line.
After trying to run the code directly in the command line, it appears to be printing the network characteristics: Network attributes: vertices = 2432 directed = TRUE hyper = FALSE loops = FALSE multiple = FALSE bipartite = 1698 total edges= 2678 missing edges= 0 non-missing edges= 2678
I have still yet figured out how or why I am getting the error code within the .Rmd file unfortunately.
Hi @jacobtnyoung! Just as a quick update, I was able to figure it out! I had a feeling that for some reason, when calling for PhxArrestNet2023, that variable must have been out of scope since R could not identify it. Within the R Markdown, I noticed that eval was set to FALSE, which will not allow the compiler to evaluate the code that read in the networks. I would imagine others will run into a similar issue once they begin, but it is an easy fix once I found it! :)
Edit: This is also why R could not identify the gplot() function as this is the same section of code where we load in our libraries.
Hi @Drake14! Glad you figured it out! 🤙🏼
Hello! I am trying to plot out the PhxArrestNet2023 network, but I have run into two different errors that I am having trouble solving. It will either say that object 'PhxArrestNet2023' is not found, or RStudio does not recognize gplot() as a function. I have made sure that the SNA and network libraries are loaded in and double checked my variable names.
Here is my current code: