pearselab / r-intro-jenessalemon

r-intro-jenessalemon created by GitHub Classroom
0 stars 1 forks source link

lesson_3 HELP #7

Open jenessalemon opened 7 years ago

jenessalemon commented 7 years ago

Will, I am drawing my polygon in lesson_3, and I cannot see why the loop is breaking. It's so strange. The first three lines are drawn, and then something happens and it just breaks. Wondering if you can help me figure out why?

willpearse commented 7 years ago

First of all, your polygon constructor is missing some braces:

polygon.generator <- new.polygon(point1, point2, point3, point4) #Something goes here
if(!inherits(point1, "point") | !inherits(point2, "point"), !inherits(point3, "point") | !inherits(point4, "point"))
  stop("You haven't given me four points!")
out = list(new.line(point1, point2), new.line(point2, point3), new.line(point3, point4), new.line(point4, point1))
return(out)
#Something goes here

...but otherwise looks (at a glance) to be fine.

Could you do me a favour? Could you pop online at https://appear.in/usubioprogramming and meet me there? It's a bit difficult to diagnose this one without speaking to you.

willpearse commented 7 years ago

PS - your code looks really good - you've really gotten the point of this exercise. It's very impressive!