Development

As these notes are a work-in-progress, we will use this chapter to collect things to be added later, that don’t currently have an obvious place in the notes.

TODO

  • TODO: head(), tail()
  • TODO: making new binary operators
  • TODO: the ... argument
  • TODO: https://adv-r.hadley.nz/functions.html
  • TODO: https://rstudio.github.io/r-manuals/r-intro/Writing-your-own-functions.html
  • TODO: https://rstudio.github.io/r-manuals/r-lang/Functions.html
  • TODO: note, looks like scalars, but…
  • TODO: spaces around binary operators
  • TODO: biggest and smallest possible doubles and integers
  • TODO: print versus return (wait until S3 to fully explain)
  • TODO: print vs cat
  • TODO: = is not equals in math, it’s assignment, also a bit about assign() and <-
  • TODO: Inf, NA, NaN, types of NA, etc
  • TODO: a bit about print vs return? (or save for later?)
  • TODO: function composition: int variables vs piping
  • TODO: ?min ?sum
  • TODO: ?Logic ?logical
    • Note: Don’t use T and F, ?Reserved
  • TODO: code execution order (when?)
  • TODO: note about recycling variable names, especially names like x in these notes
  • TODO: ?S4groupGeneric
  • TODO: using c() to combine vectors and not just “scalars”
  • TODO: arguments and values, defaults, not naming arguments, how and when to do so, f(x = x)
  • TODO: how to read documentation
  • TODO: pass-by-value
  • TODO: +(2, 3), +(e1 = 2, e2 = 3)
  • TODO: positional matching of arguments
  • TODO: (0.1 + 0.2) == 0.3
  • TODO: all.equal(0.1 + 0.2, 0.3)
  • TODO: debugging
  • TODO: installing / using packages
  • TODO: how to read documentation
  • TODO: complied vs interpreted languages
  • TODO: don’t use attach
  • TODO: create doubles via hexadecimal
  • TODO: ?letters
  • TODO: why write functions?
  • TODO: DRY
  • TODO: write the body of the function, outside of the function, first
  • TODO: “don’t repeat your functions”
  • TODO: don’t repeat computations (computation time, only need to “correct” in one place if wrong)
  • TODO: don’t use apply on data frames ” Beware that apply() coerces data frames to matrices, which is time consuming and forces all columns to have the same type. ”
  • TODO: https://twitter.com/mattdowle/status/1037949621773844480?lang=en
  • TODO: df isn’t a great name. (it’s already a function name)
  • TODO: data frames are column focused.
  • TODO: head, tail, dim, nrow, ncol
  • TODO: table, unique
  • TODO: https://theasciicode.com.ar/ascii-control-characters/bell-ascii-code-7.html
  • TODO: |> + within() https://gist.github.com/grantmcdermott/60fcb75261ae99d43377b3ab0d71c590#file-baker-r
  • TODO: https://en.m.wikipedia.org/wiki/Unix_philosophy
  • TODO: (function(x) {x ^ 2}) (1:100)
  • TODO: ((x) x^2)(1:10) (why parens and not braces?)
  • TODO: the problem with the problem: https://www.youtube.com/watch?v=t-IUY6QrJyU
  • TODO: ?by
  • TODO: https://socviz.co/appendix.html#a-little-more-about-r
  • TODO: “+”(1, 2) versus +(1, 2)
  • TODO: = vs =
  • TODO: when switching to quarto book, add gh-actions
    • ex: https://github.com/mine-cetinkaya-rundel/quarto-tutorials/blob/master/.github/workflows/build-website.yaml
    • ex: https://github.com/coatless-tutorials/quarto-book-template/blob/main/.github/workflows/quarto-render.yml
  • TODO: “base” versions do dplyr: with(), within(), subset(), transform()
  • TODO: tidyverse overview chapter
  • TODO: tinyverse overview chapter
  • TODO: https://en.m.wikipedia.org/wiki/Unix_time
ls()
objects(envir = baseenv())
objects(envir = globalenv())
objects("package:stats")
search()
lapply(search(), objects)
"dnorm" %in% objects(envir = baseenv())
# TODO: make more complete? add additional symbols?
sort(c(letters, LETTERS, 0:9, "!", "@", "#", "$", "%", "^", "&", "*", "(", ")"))
 [1] "!" "(" ")" "@" "*" "&" "#" "%" "^" "$" "0" "1" "2" "3" "4" "5" "6" "7" "8"
[20] "9" "a" "A" "b" "B" "c" "C" "d" "D" "e" "E" "f" "F" "g" "G" "h" "H" "i" "I"
[39] "j" "J" "k" "K" "l" "L" "m" "M" "n" "N" "o" "O" "p" "P" "q" "Q" "r" "R" "s"
[58] "S" "t" "T" "u" "U" "v" "V" "w" "W" "x" "X" "y" "Y" "z" "Z"
sort(c(letters, LETTERS, 0:9, paste0(letters, letters), paste0(LETTERS, LETTERS)))
  [1] "0"  "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "a"  "A"  "aa" "AA" "b" 
 [16] "B"  "bb" "BB" "c"  "C"  "cc" "CC" "d"  "D"  "dd" "DD" "e"  "E"  "ee" "EE"
 [31] "f"  "F"  "ff" "FF" "g"  "G"  "gg" "GG" "h"  "H"  "hh" "HH" "i"  "I"  "ii"
 [46] "II" "j"  "J"  "jj" "JJ" "k"  "K"  "kk" "KK" "l"  "L"  "ll" "LL" "m"  "M" 
 [61] "mm" "MM" "n"  "N"  "nn" "NN" "o"  "O"  "oo" "OO" "p"  "P"  "pp" "PP" "q" 
 [76] "Q"  "qq" "QQ" "r"  "R"  "rr" "RR" "s"  "S"  "ss" "SS" "t"  "T"  "tt" "TT"
 [91] "u"  "U"  "uu" "UU" "v"  "V"  "vv" "VV" "w"  "W"  "ww" "WW" "x"  "X"  "xx"
[106] "XX" "y"  "Y"  "yy" "YY" "z"  "Z"  "zz" "ZZ"