rcon<-file("test.R","w")
cat("test.df<-data.frame(a=factor(sample(LETTERS[1:4],100,TRUE)),
",
file=rcon)
cat("b=sample(1:4,100,TRUE),c=rnorm(100),d=rnorm(100))
",file=rcon)
cat("describe(test.df)
",file=rcon)
cat("print(freq(test.df$a))
",file=rcon)
cat("xtab(a~b,test.df)
",file=rcon)
cat("brkdn(c~b,test.df)
",file=rcon)
cat("png("hista.png")
hist(test.df$b)
dev.off()
",file=rcon)
cat("png("plotcd.png")
plot(test.df$c,test.df$d)
dev.off()
",file=rcon)
close(rcon)
# call htmlize with minimal arguments
htmlize("test.R")
# if you want to see the output, use the following line
# system(paste(options("browser")," file:",getwd(),"/test.html",sep="",collapse=""))
# to clean up, use the following line
# system("rm test.R test.html test_nav.html test_list.html hista.png plotcd.png")
Run the code above in your browser using DataLab