My Kerbal RPC scripts

analysis.rmd 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  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=timepoint / 10)) + 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. fuel <- baseg + geom_line(aes(y=fuel)) + ylab("Fuel (kg)") + ggtitle("Fuel")
  21. at <- baseg + geom_line(aes(y=available_thrust)) + ylab("Available thrust (Newtons)") + ggtitle("Available thrust")
  22. thrust <- baseg + geom_line(aes(y=current_thrust)) + ylab("Current thrust (Newtons)") + ggtitle("Current thrust")
  23. g_force <- baseg + geom_line(aes(y=g_force)) + ylab("G-force (m/s²)") + ggtitle("G-force")
  24. ```
  25. ```{r drawgraphs, echo=FALSE}
  26. alt
  27. vspd
  28. hspd
  29. mass
  30. fuel
  31. at
  32. thrust
  33. g_force
  34. ```