DarianFlorianVoda / BioShapes

Bachelor Thesis R Package
0 stars 0 forks source link

[Arrows] Correct if-condition when multiple values of d.lines #51

Closed discoleo closed 2 years ago

discoleo commented 2 years ago

Arrows: arrowTail Function

The arrowTail function uses an unsafe if statement: it will break in R 4.2 when d.lines has multiple values.

Corrected code:

### Arrow Tail:
arrowTail = function(x, y, d.lines, lwd=1, slope=NULL) {
  if(is.null(slope)) slope = compute_slope(x, y);
  if(any(d.lines != 0)) {
    arrTail = shiftLine(x, y, d = d.lines, slope=slope);
  } else {
    arrTail = list(x=x, y=y);
  }
  arrTail = list(arrTail, lwd=lwd);
  return(arrTail)
}
DarianFlorianVoda commented 2 years ago

Modified.