I was wondering how you could turn an R script into an HTML report (From the sounds of it using knitr is the way to go). I would like to do this without using RStudio if possible.
Say I have to following R script
#Load librarys + initilisation calculations
#User shouldn't see the next 2 lines
library(foo)
set.seed(42)
#User will see the next 3 lines
print("This is some text to describe what the user is about to see")
head(mtcars)
boxplot(mtcars$mpg~mtcars$cyl)
#Not shown to user:
numbers <- runif(100)
moreNumbers <- rnorm(100)
group <- c(rep("a",100), rep("b",100))
df <- data.frame(c(numbers, moreNumbers), group)
names(df) <- c("ExampleData", "g")
#Show to user
t.test(df$ExampleData~df$g)
I've tried having a look around the internet and feel as if all the steps are just a little too far ahead of what I understand.
Do I need to make another R script which contains a stitch()/knit() function which calls the script above?
Thanks,