20 Deprecated exercises
20.1 Expressions (new)
base::alist()is useful for creating pairlists to be used for function arguments:
alist()special compared to
alist handles its arguments as if they described function arguments. So the values are not evaluated, and tagged arguments with no value are allowed whereas list simply ignores them. alist is most often used in conjunction with formals.
20.2 Quasiquotation (new)
Q: Why does
deparse()? Why does
pairwise.t.test()use them? Read the source code.
as.Date.default()uses them to convert unexpected input expressions (neither dates, nor
NAs) into a character string and return it within an error message.
pairwise.t.test()uses them to convert the names of its datainputs (response vector
xand grouping factor
g) into character strings to format these further into a part of the desired output.
deparse()always returns a length one character vector. Can you construct an input that violates this expectation? What happens?
A: We can pass an expression to one of
pairwise.t.test()’s data input arguments, which exceeds the default cutoff width in
deparse(). The expression will be split into a character vector of length greater 1. The deparsed data inputs are directly pasted (read the source code!) with “and” as separator and the result is just used to be displayed in the output. Just the data.name output will change (it will include more than one “and”).