Public
Authored by Gareth Palidwor

R code to determine percentage of time each planet is the closest over the last 50 years.

Inspired by a question on BBC "more or less" stats podcast where they were talking about which planet is the closest to the earth on average; answer is Mercury at 45%

Mercury   Venus    Mars Jupiter  Saturn  Uranus Neptune   Pluto 
  44.99   36.65   18.36    0.00    0.00    0.00    0.00    0.00
Edited
680 Bytes
  • Quick visualisation of the data:

    closest_table<-plan2[,3:5]==apply(plan2[,3:5],1,min)
    cols<-rep("black",nrow(plan2))
    cols[closest_table[,2]]<-"red"
    cols[closest_table[,3]]<-"green"
    matplot(plan2[,3:10],pch=20,cex=0.4)
    points(1:nrow(plan2),rep(0,nrow(plan2)),col=cols,pch="|",cex=0.5)

    closest_planet_vis

    Edited by Christopher Porter
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment