My Kerbal RPC scripts

analysis.rmd 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---
  2. title: "Flight analysis"
  3. ---
  4. This file creates graphs of recorded flight parameters
  5. ```{r opts, include=FALSE}
  6. library(knitr)
  7. opts_chunk$set(tidy=TRUE)
  8. ```
  9. ```{r init}
  10. library(ggplot2)
  11. library(scales)
  12. flight <- read.csv("flight.csv", header=T)
  13. ```
  14. ```{r graph}
  15. baseg <- ggplot(flight, aes(x=mission_time)) + xlab("Time (seconds)") + theme_classic()
  16. alt <- baseg + geom_line(aes(y=current_altitude)) + ylab("Altitude (m)") + ggtitle("Altitude")
  17. vspd <- baseg + geom_line(aes(y=v_speed)) + ylab("Vertical speed (m/s)") + ggtitle("Vertical speed")
  18. hspd <- baseg + geom_line(aes(y=h_speed)) + ylab("Horizontal speed (m/s)") + ggtitle("Horizontal speed")
  19. mass <- baseg + geom_line(aes(y=mass)) + ylab("Vessel mass (kg)") + ggtitle("Mass")
  20. ec <- baseg + geom_line(aes(y=electric_charge)) + ylab("Electric charge") + ggtitle("Electric charge")
  21. lf <- baseg + geom_line(aes(y=liquid_fuel)) + ylab("Liquid fuel (litres)") + ggtitle("Liquid fuel")
  22. ox <- baseg + geom_line(aes(y=oxidizer)) + ylab("Oxidizer (litres)") + ggtitle("Oxidizer")
  23. at <- baseg + geom_line(aes(y=available_thrust)) + ylab("Available thrust (Newtons)") + ggtitle("Available thrust")
  24. thrust <- baseg + geom_line(aes(y=current_thrust)) + ylab("Current thrust (Newtons)") + ggtitle("Current thrust")
  25. g_force <- baseg + geom_line(aes(y=g_force)) + ylab("G-force (m/s²)") + ggtitle("G-force")
  26. ```
  27. ```{r drawgraphs, echo=FALSE}
  28. alt
  29. vspd
  30. hspd
  31. mass
  32. ec
  33. lf
  34. ox
  35. at
  36. thrust
  37. g_force
  38. ```