I'm following the following guide: https://joshldavis.com/2014/04/12/beginners-tutorial-for-knitr/
I've installed the
knitr package and run it in R, and I'm trying to copy and paste the example from the link above:
From ISLR: Chapter 3, Problem 14. Using a created simulated data, answer the questions regarding simple linear regression. <<>>= # Ensure consistent values set.seed(1) # Create uniform distribution for first input x1 <- runif(100) # Normal distribution for second input x2 <- 0.5 * x1 + rnorm(100) / 10 # Our Linear Model y <- 2 + (2 * x1) + (.3 * x2) + rnorm(100) @
However, when I try to run it, I get the following error in Latex:
! You can't use `macro parameter character #' in horizontal mode. l.30 # Ensure consistent values ?
I'm not quite sure what I'm doing wrong here? Is there any package I'm supposed to run in Latex as well?