Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 15431

Change color using an if() statement in an interaction network in R

$
0
0

I intended to create a function to color my network according to three conditions ( = variable abundances), but only the first one is taken into account. Do you know where is the problem ? I think there is a thing in the [1,1] because I want all my data frame to be taken into account and not just the first column.I precise that the second condition (> 5) means the abundances between 5 and 15, but I did not how to ask properly for an interval.Thanks a lot !enter image description here

my_gTree <- grid.grabExpr(grid.echo(function() plotweb(sortweb(web_family, sort.order="dec"),                                                        method="normal",                                                         text.rot = 90,                                                        labsize = 1.5,                                                       y.width.low = 0.08,                                                        y.width.high = 0.08,                                                       col.interaction = if(web_family[1,1] > 10) {                                                           adjustcolor('darkturquoise', alpha.f = 0.5)})))                                                         } else if(web_family[1,1] > 10){                                                           adjustcolor('green', alpha.f = 0.5)                                                           }                                                       else if(web_family[1,1] < 10){                                                         adjustcolor('grey', alpha.f = 0.5)})))

Viewing all articles
Browse latest Browse all 15431

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>