Watts-College / crj-507-spring-2024

https://watts-college.github.io/crj-507-spring-2024/
MIT License
1 stars 0 forks source link

Lab 05- Part 1 #'s 9 & 10 #24

Closed CGUEVARR closed 5 months ago

CGUEVARR commented 5 months ago

I am stuck on the vertex attribute. I used the max function to identify the actor with the greatest degree of centrality which only returns a number not the name of the person. So then I had to search for that number in the table. Same thing for #10 and the place name. Is there an easier way to return the actual name of the actor or event from the table instead?

<br>

#### 9. Using the vertex attribute `people.names`, discuss which individual is most central in the network.

```{r}

# Your code here

max(actor.deg)
jacobtnyoung commented 5 months ago

Hi @CGUEVARR! Good question! You can use the sort() function. That will order a numeric object in ascending order. See the help, ?sort for shifting to descending order.

Let me know if that doesn't work for you!

CGUEVARR commented 5 months ago

When I use the code to label my plot.....

execute the plot

gplot( philkidnapmat,
label = network.vertex.names( PhilKidnapNet ),

# the labels we want

gmode = "twomode", # indicate it is two modes usearrows = FALSE, # turn off the arrowheads label.cex=.5, # size the labels main="Philippine Kidnaping Standardized Degree", # add a title vertex.col = node.col, # add the colors

here is the addition to what we had above:

vertex.cex = v.size + 2 # set the size (add 0.5 so it is not too small) )

I get this error...

Error in network.vertex.names(): ! network.vertex.names requires an argument of class network. Backtrace:

  1. sna::gplot(...)
  2. network::network.vertex.names(PhilKidnapNet)
jjgillis0 commented 5 months ago

It may be your second line is not PhilKidnapNet because they don't match

CGUEVARR commented 5 months ago

Thanks Jenny, I'll try changing it and see what happens

CGUEVARR commented 5 months ago

Still not working with that change ...

Error: ! object 'PhilKidnapmat' not found Backtrace:

  1. sna::gplot(...)
  2. network::network.vertex.names(PhilKidnapmat)
  3. network::is.network(x) Execution halted
jacobtnyoung commented 5 months ago

Hi @CGUEVARR. Email me your .Rmd file to CRJ507@asu.edu. I will try to debug it.

Thanks @jjgillis0 for helping!

CGUEVARR commented 5 months ago

Thank you, Professor! Email sent!

jacobtnyoung commented 5 months ago

Hi @CGUEVARR , I didn't get the email with the document. Please resend if you can.

jacobtnyoung commented 5 months ago

Hi @CGUEVARR see my email.