gge-ucd / Discussion

Class discussion for R-DAVIS course
0 stars 4 forks source link

Pasting multiple lines of code into an issue and also: making a heart <3 #51

Closed munozbird closed 5 years ago

munozbird commented 5 years ago

Can people try out the following code and see if it works?

dat <- data.frame(t=seq(0,2*pi, by=0.01)) 
xhrt<- function(t) 16*sin(t)^3
yhrt<- function(t)
  13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)
dat$y=yhrt(dat$t)
dat$x=xhrt(dat$t)

with(dat, plot(x,y,type="l", axes=FALSE, frame.plot=FALSE,xlab="Happy Valentine's Day!", ylab=""))
with(dat, polygon(x,y,col="#FF7575"))

EDIT: Ok I actually can't figure out how to attach a big chunk of code without it going haywire when you copy-paste it to R. If you copy-paste this, the asterisks turn into underscores.

EDIT2: Pro-tip: For large chunks of code in an issue, use THREE backticks ( ```) before and after your code! This is now the most-edited issue ever.

ryanpeek commented 5 years ago

Love the code @munozbird! Could you do two things for me?

  1. Edit the issue title to be something that will help us search for this in the future...short and informative. Maybe, "pasting code into issue and making a heart..." or something a long those lines.
  2. Once you feel good about this, I think you should be able to click the "Close and Comment" button at the bottom. It's a way to tidy up which issues have been addressed, and which are still ongoing.

Thanks for participating, and for the fun code!