Question: as _ adjacency _ matrix ( network , attr = weight, type = both ) | > as . matrix ( ) | > as

as_adjacency_matrix(network, attr = "weight", type = "both")|>
as.matrix()|> as_tibble(rownames = "from")|>
# pivot from wide to long format
pivot_longer(-from, names_to ="to", values_to = "weight")|>
ggplot()+ geom_tile(aes(x = to, y = from, fill = weight), color = "gray50")+
scale_fill_gradient(low = "white", high = "darkblue")+
theme(axis.text.x = element_text(angle =90, hjust =1, vjust =0.5))
why doesn't the code works

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!