A Report Generated by knitr

This report is automatically generated with the R package knitr (version `1.5`) .

    # Chapter 3 - The Fundamentals of R Using the Full Power of Functions Vectorizing your
    # functions
    baskets.of.Granny <- c(12, 4, 4, 6, 9, 3)
    baskets.of.Granny

    ## [1] 12  4  4  6  9  3

    sum(baskets.of.Granny)

    ## [1] 38

    firstnames <- c("Joris", "Carolien", "Koen")
    lastname <- "Meys"
    paste(firstnames, lastname)

    ## [1] "Joris Meys"    "Carolien Meys" "Koen Meys"

    authors <- c("Andrie", "Joris")
    lastnames <- c("de Vries", "Meys")
    paste(authors, lastnames)

    ## [1] "Andrie de Vries" "Joris Meys"

    ## Putting the argument in a function print() ### This line of code leads to deliberate
    ## error for illustration
    print(x = "Isn't this fun?")

    ## [1] "Isn't this fun?"

    print(digits = 4, x = 11/7)

    ## [1] 1.571

    # Making history
    savehistory(file = "Chapter3.Rhistory")
    loadhistory("Chapter3.Rhistory")
    # Keeping Your Code Readable Following naming conventions Choosing a clear name
    paste <- paste("This gets", "confusing")
    paste

    ## [1] "This gets confusing"

    paste("Don't", "you", "think?")

    ## [1] "Don't you think?"

    ## Choosing a naming style Structuring your code
    baskets.of.Geraldine <- c(5, 3, 2, 2, 12, 9)
    Intro <- "It is amazing! The All Star Grannies scored\na total of"
    Outro <- "baskets in the last six games!"
    Total.baskets <- baskets.of.Granny + baskets.of.Geraldine
    Text <- paste(Intro, sum(Total.baskets), Outro)
    cat(Text)

    ## It is amazing! The All Star Grannies scored
    ## a total of 71 baskets in the last six games!

    Text

    ## [1] "It is amazing! The All Star Grannies scored\na total of 71 baskets in the last six games!"

    cat("If you doubt whether it works,\n+ just try it out.")

    ## If you doubt whether it works,
    ## + just try it out.

    ## Adding comments The All Star Grannies do it again!
    baskets.of.Granny <- c(12, 4, 4, 6, 9, 3)  # Granny rules
    sum(baskets.of.Granny)  # total number of points

    ## [1] 38

    # Getting from Base R to More Finding packages Installing packages
    install.packages("fortunes")

    ## Installing package into 'C:/Users/Andrie/Documents/R/win-library/3.0'
    ## (as 'lib' is unspecified)

    ## package 'fortunes' successfully unpacked and MD5 sums checked
    ##
    ## The downloaded binary packages are in
    ## 	C:\Users\Andrie\AppData\Local\Temp\RtmpKC3x2f\downloaded_packages

    library("fortunes")
    fortune("This is R")

    ##
    ## Evelyn Hall: I would like to know how (if) I can extract some of the information from the
    ## summary of my nlme.
    ## Simon Blomberg: This is R. There is no if. Only how.
    ##    -- Evelyn Hall and Simon 'Yoda' Blomberg
    ##       R-help (April 2005)

    fortune(161)

    ##
    ## (3 times...rrrrgh...) and why do you think the mailing list is called R-*packages*
    ## ???????????
    ## Please do
    ##   for(i in 1:20) cat("It's a package!\n")
    ##    -- Martin Maechler (after a newly released *package* has been called *library* three
    ##       times in its announcement on R-packages)
    ##       R-help (March 2006)

    detach(package:fortunes)

The R session information (including the OS info, R version and all packages used):

    sessionInfo()

    ## R version 3.0.2 (2013-09-25)
    ## Platform: x86_64-w64-mingw32/x64 (64-bit)
    ##
    ## locale:
    ## [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252
    ## [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
    ## [5] LC_TIME=English_United Kingdom.1252
    ##
    ## attached base packages:
    ## [1] stats     graphics  grDevices utils     datasets  methods   base
    ##
    ## other attached packages:
    ##  [1] BiocInstaller_1.12.1 ggplot2_0.9.3.1      reshape2_1.2.2       sos_1.3-8
    ##  [5] brew_1.0-6           stringr_0.6.2        knitr_1.5            plyr_1.8
    ##  [9] Revobase_7.1.0       RevoMods_7.1.0       RevoScaleR_7.1.0     lattice_0.20-27
    ## [13] rpart_4.1-2
    ##
    ## loaded via a namespace (and not attached):
    ##  [1] codetools_0.2-8    colorspace_1.2-4   dichromat_2.0-0    digest_0.6.4
    ##  [5] evaluate_0.5.1     foreach_1.4.1      formatR_0.10       fortunes_1.5-2
    ##  [9] grid_3.0.2         gtable_0.1.2       highr_0.3          iterators_1.0.6
    ## [13] labeling_0.2       MASS_7.3-29        munsell_0.4.2      proto_0.3-10
    ## [17] RColorBrewer_1.0-5 scales_0.2.3       tools_3.0.2

    Sys.time()

    ## [1] "2014-05-13 15:05:27 BST"