Created
December 29, 2016 07:03
-
-
Save actuaryactually/9a8c7f39db56f2aa70b590c490d18d01 to your computer and use it in GitHub Desktop.
Formatting Tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setwd("C:/OldWorld/Blog/DataWrangling") | |
#Output console results to file: | |
# anova test | |
anova_test = aov(yield ~ block + N * P + K, npk) | |
anova_test | |
# t test | |
t_test = t.test(1:10, y = c(7:20)) | |
t_test | |
##Now write both results to file: | |
# Title | |
cat("Tests Output", file = "tests.txt") | |
# add 2 newlines | |
cat("\n\n", file = "tests.txt", append = TRUE) | |
# export anova test output | |
cat("Anova Test\n", file = "tests.txt", append = TRUE) | |
capture.output(anova_test, file = "tests.txt", append = TRUE) | |
# add 2 newlines | |
cat("\n\n", file = "tests.txt", append = TRUE) | |
# export t-test output | |
cat("T-Test\n", file = "tests.txt", append = TRUE) | |
capture.output(t_test, file = "tests.txt", append = TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment