im aware of sink()
and capture.output()
. Somehow I cant get my desired result.
example of my codeblock
mtcars[1:2,1:2]
#this is awesome,
mtcars[1:2,1:2] %>% rowMeans(.)
Desired output in my txt file: Must look 100% like in my console:
> mtcars[1:2,1:2] mpg cyl Mazda RX4 21 6 Mazda RX4 Wag 21 6 > #this is awesome, > mtcars[1:2,1:2] %>% rowMeans(.) Mazda RX4 Mazda RX4 Wag 13.5 13.5
Preudocode
It would be nice to have something like this:
console2txt(file="text.txt")
mtcars[1:2,1:2]
#this is awesome,
mtcars[1:2,1:2] %>% rowMeans(.)
dev.off()
Is there a solution to caputure the entire console of a "script block".