0

Does anyone have any idea why my knitr output into html or pdf is so drastically different than what is displayed in the console?

Console: Console Output

Knitr: Knitr Output

ggplot(walk.com, aes(x=Time, y=pos.VERT)) + geom_point() + geom_line() + labs(x="Time (s)",y="Vertical Position (m)") + ggtitle("Walking Vertical Position vs Time")

It is almost like the y axis is being rounded with the output causing discrete variables... I can't seem to figure out what is causing this. Any input would be greatly appreciated. Thanks!

  • apologies the code should be ggplot(walk.com, aes(x=Time, y=pos.VERT)) + geom_point() + geom_line() + labs(x="Time (s)",y="Vertical Position (m)") + ggtitle("Walking Vertical Position vs Time") – PointsNorth Sep 26 '16 at 22:44
  • You can edit your post rather than post a correction in the comments – KS7X Sep 26 '16 at 22:47
  • 3
    Without data this problem is not [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – alistaire Sep 26 '16 at 22:55
  • 2
    Can you paste into your question a data sample (use `dput()`), a minimal knitr document that reproduces this effect when run on the data sample, and the exact code you ran in the console (including any data transformations before the ggplot2 code.) – eipi10 Sep 26 '16 at 22:55
  • What @eipi10 and @alistaire said plus: Please check whether the data used in the document is identical to the data used in the console. You could print `fivenum(walk.com)` (in the document and in the console) as a first indicator. – CL. Sep 27 '16 at 06:09
  • 1
    As a starting point: reset the R session (e.g., close and re-open R), then run the full code and see what is produced in the console. My guess is that there is a data processing step where the values were rounded in the document, but that was skipped (or reversed) during your session at the console. If that doesn't clarify the issue, then, everyone else is spot on: we need the full code and data in an MWE to help. – Mark Peterson Sep 27 '16 at 15:03

0 Answers0