Chapter 2 Introduction To Using R
This chapter presents concepts that are foundational for interacting with the R environment and understanding how computations are carried out. Readers with little experience using R will benefit greatly from ensuring that these concepts are understood before moving on in the text.
At its core, R is a functional programming language wherein objects are created and manipulated by calling functions. Therefore, this chapter begins by introducing functions in R, starting with a special class of functions, known as the primitive functions. In 2008, the core of the R language was re-written in C. These primitive-class functions are part of the base R installation (residing in the package base) and call these internal C primitives. Table 2.1 shows the primitive functions in R version 3.6.1 (2019-07-05).
| $ | length | sinpi | function | is.character |
| $<- | != | dimnames | is.single | oldClass<- |
| [ | digamma | asin | is.null | is.environment |
| [<- | exp | as.character | is.language | attributes |
| [[ | floor | %/% | is.pairlist | break |
| [[<- | acos | is.na | .External.graphics | return |
| %*% | seq.int | < | globalenv | attr |
| xtfrm | abs | > | class<- | tracemem |
| c | length<- | Im | .Primitive | next |
| all | sqrt | %% | is.logical | .Call.graphics |
| any | ! | trigamma | enc2utf8 | standardGeneric |
| sum | acosh | == | UseMethod | is.atomic |
| prod | is.nan | cumsum | .subset | retracemem |
| max | Re | atanh | proc.time | expression |
| min | tanh | sign | enc2native | is.expression |
| range | names | ceiling | repeat | call |
| is.matrix | cospi | Conj | <<- | is.object |
| >= | & | as.call | @<- | pos.to.env |
| cosh | anyNA | log1p | missing | attributes<- |
| cummax | trunc | expm1 | nargs | .primUntrace |
| dimnames<- | cummin | ( | isS4 | …length |
| as.raw | levels<- | : | .isMethodsDispatchOn | .External |
| log2 | * | = | forceAndCall | oldClass |
| tan | Mod | @ | .primTrace | .Internal |
| dim | | | { | storage.mode<- | .Fortran |
| as.logical | names<- | ~ | .Call | browser |
| ^ | + | && | unclass | is.double |
| is.finite | log | .C | gc.time | while |
| sinh | lgamma | baseenv | .subset2 | nzchar |
| log10 | as.complex | quote | environment<- | is.list |
| as.numeric | asinh | <- | emptyenv | lazyLoadDBfetch |
| dim<- | - | is.name | seq_len | …elt |
| is.array | sin | if | .External2 | is.integer |
| tanpi | / | || | is.symbol | is.function |
| gamma | as.environment | attr<- | class | is.recursive |
| atan | <= | untracemem | on.exit | seq_along |
| as.integer | as.double | .cache_class | is.raw | unlist |
| Arg | is.infinite | substitute | for | as.vector |
| signif | is.numeric | interactive | is.complex | lengths |
| cumprod | rep | is.call | list | |
| cos | round | switch | invisible |