Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
14
3.28k
An Introduction to R
# An Introduction to R This is an introduction to R (“GNU S”), a language and environment for statistical computing and graphics. R is similar to the award-winning[1](#FOOT1) S system, which was developed at Bell Laboratories by John Chambers et al. It provides a wide variety of statistical and graphical techniques (li...
## Preface This introduction to R is derived from an original set of notes describing the S and S-PLUS environments written in 1990–2 by Bill Venables and David M. Smith when at the University of Adelaide. We have made a number of small changes to reflect differences between the R and S programs, and expanded some of t...
#### Suggestions to the reader Most R novices will start with [A sample session](#A-sample-session). This should give some familiarity with the style of R sessions and more importantly some instant feedback on what actually happens. Many users will come to R mainly for its graphical facilities. See [Graphical procedure...
## 1 Introduction and preliminaries - [The R environment](#The-R-environment) - [Related software and documentation](#Related-software-and-documentation) - [R and statistics](#R-and-statistics) - [R and the window system](#R-and-the-window-system) - [Using R interactively](#Using-R-interactively) - [An intr...
### 1.1 The R environment R is an integrated suite of software facilities for data manipulation, calculation and graphical display. Among other things it has - an effective data handling and storage facility, - a suite of operators for calculations on arrays, in particular matrices, - a large, coherent, integrate...
### 1.2 Related software and documentation R can be regarded as an implementation of the S language which was developed at Bell Laboratories by Rick Becker, John Chambers and Allan Wilks, and also forms the basis of the S-PLUS systems. The evolution of the S language is characterized by four books by John Chambers and ...
### 1.3 R and statistics Our introduction to the R environment did not mention *statistics*, yet many people use R as a statistics system. We prefer to think of it of an environment within which many classical and modern statistical techniques have been implemented. A few of these are built into the base R environment,...
### 1.4 R and the window system The most convenient way to use R is at a graphics workstation running a windowing system. This guide is aimed at users who have this facility. In particular we will occasionally refer to the use of R on an X window system although the vast bulk of what is said applies generally to any im...
### 1.5 Using R interactively When you use the R program it issues a prompt when it expects input commands. The default prompt is ‘`>`’, which on UNIX might be the same as the shell prompt, and so it may appear that nothing is happening. However, as we shall see, it is easy to change to a different R prompt if you wish...
### 1.5 Using R interactively To use R under Windows the procedure to follow is basically the same. Create a folder as the working directory, and set that in the `Start In` field in your R shortcut. Then launch R by double clicking on the icon. ------------------------------------------------------------------------
### 1.6 An introductory session Readers wishing to get a feel for R at a computer before proceeding are strongly advised to work through the introductory session given in [A sample session](#A-sample-session). ------------------------------------------------------------------------
### 1.7 Getting help with functions and features R has an inbuilt help facility similar to the `man` facility of UNIX. To get more information on any specific named function, for example `solve`, the command is ```r > help(solve) ``` An alternative is ```r > ?solve ``` For a feature specified by special characters, the...
### 1.7 Getting help with functions and features ------------------------------------------------------------------------
### 1.8 R commands, case sensitivity, etc. Technically R is an *expression language* with a very simple syntax. It is *case sensitive* as are most UNIX based packages, so `A` and `a` are different symbols and would refer to different variables. The set of symbols which can be used in R names depends on the operating sy...
### 1.8 R commands, case sensitivity, etc. on second and subsequent lines and continue to read input until the command is syntactically complete. This prompt may be changed by the user. We will generally omit the continuation prompt and indicate continuation by simple indenting. Command lines entered at the console are...
### 1.9 Recall and correction of previous commands Under many versions of UNIX and on Windows, R provides a mechanism for recalling and re-executing previous commands. The vertical arrow keys on the keyboard can be used to scroll forward and backward through a *command history*. Once a command is located in this way, t...
### 1.10 Executing commands from or diverting output to a file If commands[5](#FOOT5) are stored in an external file, say `commands.R` in the working directory `work`, they may be executed at any time in an R session with the command ```r > source("commands.R") ``` For Windows **Source** is also available on the **File...
### 1.11 Data permanency and removing objects The entities that R creates and manipulates are known as *objects*. These may be variables, arrays of numbers, character strings, functions, or more general structures built from such components. During an R session, objects are created and stored by name (we discuss this p...
### 1.11 Data permanency and removing objects It is recommended that you should use separate working directories for analyses conducted with R. It is quite common for objects with names `x` and `y` to be created during an analysis. Names like this are often meaningful in the context of a single analysis, but it can be ...
## 2 Simple manipulations; numbers and vectors - [Vectors and assignment](#Vectors-and-assignment) - [Vector arithmetic](#Vector-arithmetic) - [Generating regular sequences](#Generating-regular-sequences) - [Logical vectors](#Logical-vectors) - [Missing values](#Missing-values) - [Character vectors](#Charac...
### 2.1 Vectors and assignment R operates on named *data structures*. The simplest such structure is the numeric *vector*, which is a single entity consisting of an ordered collection of numbers. To set up a vector named `x`, say, consisting of five numbers, namely 10.4, 5.6, 3.1, 6.4 and 21.7, use the R command ```r >...
### 2.1 Vectors and assignment the reciprocals of the five values would be printed at the terminal (and the value of `x`, of course, unchanged). The further assignment ```r > y <- c(x, 0, x) ``` would create a vector `y` with 11 entries consisting of two copies of `x` with a zero in the middle place. ------------------...
### 2.2 Vector arithmetic Vectors can be used in arithmetic expressions, in which case the operations are performed element by element. Vectors occurring in the same expression need not all be of the same length. If they are not, the value of the expression is a vector with the same length as the longest vector which o...
### 2.2 Vector arithmetic or sample variance. If the argument to `var()` is an *n*-by-*p* matrix the value is a *p*-by-*p* sample covariance matrix got by regarding the rows as independent *p*-variate sample vectors. `sort(x)` returns a vector of the same size as `x` with the elements arranged in increasing order; howe...
### 2.3 Generating regular sequences R has a number of facilities for generating commonly used sequences of numbers. For example `1:30` is the vector `c(1, 2, …, 29, 30)`. The colon operator has high priority within an expression, so, for example `2*1:15` is the vector `c(2, 4, …, 28, 30)`. Put `n <- 10` and compare th...
### 2.3 Generating regular sequences The fifth argument may be named `along=vector`, which is normally used as the only argument to create the sequence `1, 2, …, length(vector)`, or the empty sequence if the vector is empty (as it can be). A related function is `rep()` which can be used for replicating an object in var...
### 2.4 Logical vectors As well as numerical vectors, R allows manipulation of logical quantities. The elements of a logical vector can have the values `TRUE`, `FALSE`, and `NA` (for “not available”, see below). The first two are often abbreviated as `T` and `F`, respectively. Note however that `T` and `F` are just var...
### 2.5 Missing values In some cases the components of a vector may not be completely known. When an element or value is “not available” or a “missing value” in the statistical sense, a place within a vector may be reserved for it by assigning it the special value `NA`. In general any operation on an `NA` becomes an `N...
### 2.6 Character vectors Character quantities and character vectors are used frequently in R, for example as plot labels. Where needed they are denoted by a sequence of characters delimited by the double quote character, e.g., `"x-values"`, `"New iteration results"`. Character strings are entered using either matching...
### 2.6 Character vectors ------------------------------------------------------------------------
### 2.7 Index vectors; selecting and modifying subsets of a data set Subsets of the elements of a vector may be selected by appending to the name of the vector an *index vector* in square brackets. More generally any expression that evaluates to a vector may have subsets of its elements similarly selected by appending ...
### 2.7 Index vectors; selecting and modifying subsets of a data set selects the first 10 elements of `x` (assuming `length(x)` is not less than 10). Also ```r > c("x","y")[rep(c(1,2,2,1), times=4)] ``` (an admittedly unlikely thing to do) produces a character vector of length 16 consisting of `"x",...
### 2.7 Index vectors; selecting and modifying subsets of a data set replaces any missing values in `x` by zeros and ```r > y[y < 0] <- -y[y < 0] ``` has the same effect as ```r > y <- abs(y) ``` ------------------------------------------------------------------------
### 2.8 Other types of objects Vectors are the most important type of object in R, but there are several others which we will meet more formally in later sections. - *matrices* or more generally *arrays* are multi-dimensional generalizations of vectors. In fact, they *are* vectors that can be indexed by two or more i...
## 3 Objects, their modes and attributes - [Intrinsic attributes: mode and length](#The-intrinsic-attributes-mode-and-length) - [Changing the length of an object](#Changing-the-length-of-an-object) - [Getting and setting attributes](#Getting-and-setting-attributes) - [The class of an object](#The-class-of-an-ob...
### 3.1 Intrinsic attributes: mode and length The entities R operates on are technically known as *objects*. Examples are vectors of numeric (real) or complex values, vectors of logical values and vectors of character strings. These are known as “atomic” structures since their components are all of the same type, or *m...
### 3.1 Intrinsic attributes: mode and length By the *mode* of an object we mean the basic type of its fundamental constituents. This is a special case of a “property” of an object. Another property of every object is its *length*. The functions `mode(object)` and `length(object)` can be used to find out the mode and l...
### 3.2 Changing the length of an object An “empty” object may still have a mode. For example ```r > e <- numeric() ``` makes `e` an empty vector structure of mode numeric. Similarly `character()` is a empty character vector, and so on. Once an object of any size has been created, new components may be added to it simp...
### 3.3 Getting and setting attributes The function `attributes(object)` returns a list of all the non-intrinsic attributes currently defined for that object. The function `attr(object, name)` can be used to select a specific attribute. These functions are rarely used, except in rather special circumstances when some n...
### 3.4 The class of an object All objects in R have a *class*, reported by the function `class`. For simple vectors this is just the mode, for example `"numeric"`, `"logical"`, `"character"` or `"list"`, but `"matrix"`, `"array"`, `"factor"` and `"data.frame"` are other possible values. A special attribute known as th...
## 4 Ordered and unordered factors A *factor* is a vector object used to specify a discrete classification (grouping) of the components of other vectors of the same length. R provides both *ordered* and *unordered* factors. While the “real” application of factors is with model formulae (see [Contrasts](#Contrasts)), we...
### 4.1 A specific example Suppose, for example, we have a sample of 30 tax accountants from all the states and territories of Australia[14](#FOOT14) and their individual state of origin is specified by a character vector of state mnemonics as ```r > state <- c("tas", "sa", "qld", "nsw", "nsw", "nt", "wa", "wa", ...
### 4.2 The function `tapply()` and ragged arrays To continue the previous example, suppose we have the incomes of the same tax accountants in another vector (in suitably large units of money) ```r > incomes <- c(60, 49, 40, 61, 64, 60, 59, 54, 62, 69, 70, 42, 56, 61, 61, 61, 58, 51, 48, 65, 49, 49, 41, ...
### 4.2 The function `tapply()` and ragged arrays (Writing functions will be considered later in [Writing your own functions](#Writing-your-own-functions). Note that R’s a builtin function `sd()` is something different.) After this assignment, the standard errors are calculated by ```r > incster <- tapply(incomes, stat...
### 4.2 The function `tapply()` and ragged arrays The combination of a vector and a labelling factor is an example of what is sometimes called a *ragged array*, since the subclass sizes are possibly irregular. When the subclass sizes are all the same the indexing may be done implicitly and much more efficiently, as we ...
### 4.3 Ordered factors The levels of factors are stored in alphabetical order, or in the order they were specified to `factor` if they were specified explicitly. Sometimes the levels will have a natural ordering that we want to record and want our statistical analysis to make use of. The `ordered()` function creates s...
## 5 Arrays and matrices - [Arrays](#Arrays) - [Array indexing. Subsections of an array](#Array-indexing) - [Index matrices](#Index-matrices) - [The `array()` function](#The-array_0028_0029-function) - [The outer product of two arrays](#The-outer-product-of-two-arrays) - [Generalized transpose of an array](...
### 5.1 Arrays An array can be considered as a multiply subscripted collection of data entries, for example numeric. R allows simple facilities for creating and handling arrays, and in particular the special case of matrices. A dimension vector is a vector of non-negative integers. If its length is *k* then the array i...
### 5.2 Array indexing. Subsections of an array Individual elements of an array may be referenced by giving the name of the array followed by the subscripts in square brackets, separated by commas. More generally, subsections of an array may be specified by giving a sequence of *index vectors* in place of subscripts; h...
### 5.3 Index matrices As well as an index vector in any subscript position, a matrix may be used with a single *index matrix* in order either to assign a vector of quantities to an irregular collection of elements in the array, or to extract an irregular collection as a vector. A matrix example makes the process clear...
### 5.3 Index matrices Negative indices are not allowed in index matrices. `NA` and zero values are allowed: rows in the index matrix containing a zero are ignored, and rows containing an `NA` produce an `NA` in the result. As a less trivial example, suppose we wish to generate an (unreduced) design matrix for a block ...
### 5.4 The `array()` function As well as giving a vector structure a `dim` attribute, arrays can be constructed from vectors by the `array` function, which has the form ```r > Z <- array(data_vector, dim_vector) ``` For example, if the vector `h` contains 24 or fewer, numbers then the command ```r > Z <- array(h, dim=...
### 5.4 The `array()` function makes `D` a similar array with its data vector being the result of the given element-by-element operations. However the precise rule concerning mixed array and vector calculations has to be considered a little more carefully. - [Mixed vector and array arithmetic. The recycling rule](#Th...
#### 5.4.1 Mixed vector and array arithmetic. The recycling rule The precise rule affecting element by element mixed calculations with vectors and arrays is somewhat quirky and hard to find in the references. From experience we have found the following to be a reliable guide. - The expression is scanned from left to ...
### 5.5 The outer product of two arrays An important operation on arrays is the *outer product*. If `a` and `b` are two numeric arrays, their outer product is an array whose dimension vector is obtained by concatenating their two dimension vectors (order is important), and whose data vector is got by forming all possib...
#### An example: Determinants of 2 by 2 single-digit matrices As an artificial but cute example, consider the determinants of *2* by *2* matrices *\[a, b; c, d\]* where each entry is a non-negative integer in the range *0, 1, ..., 9*, that is a digit. The problem is to find the determinants, *ad - bc*, of all possible ...
### 5.6 Generalized transpose of an array The function `aperm(a, perm)` may be used to permute an array, `a`. The argument `perm` must be a permutation of the integers *{1, ..., k}*, where *k* is the number of subscripts in `a`. The result of the function is an array of the same size as `a` but with old dimension given...
### 5.7 Matrix facilities As noted above, a matrix is just an array with two subscripts. However it is such an important special case it needs a separate discussion. R contains many operators and functions that are available only for matrices. For example `t(X)` is the matrix transpose function, as noted above. The fun...
#### 5.7.1 Matrix multiplication The operator `%*%` is used for matrix multiplication. An *n* by *1* or *1* by *n* matrix may of course be used as an *n*-vector if in the context such is appropriate. Conversely, vectors which occur in matrix multiplication expressions are automatically promoted either to row or column ...
#### 5.7.2 Linear equations and inversion Solving linear equations is the inverse of matrix multiplication. When after ```r > b <- A %*% x ``` only `A` and `b` are given, the vector `x` is the solution of that linear equation system. In R, ```r > solve(A,b) ``` solves the system, returning `x` (up to some accuracy loss...
#### 5.7.3 Eigenvalues and eigenvectors The function `eigen(Sm)` calculates the eigenvalues and eigenvectors of a symmetric matrix `Sm`. The result of this function is a list of two components named `values` and `vectors`. The assignment ```r > ev <- eigen(Sm) ``` will assign this list to `ev`. Then `ev$val` is the vec...
#### 5.7.4 Singular value decomposition and determinants The function `svd(M)` takes an arbitrary matrix argument, `M`, and calculates the singular value decomposition of `M`. This consists of a matrix of orthonormal columns `U` with the same column space as `M`, a second matrix of orthonormal columns `V` whose column ...
#### 5.7.5 Least squares fitting and the QR decomposition The function `lsfit()` returns a list giving results of a least squares fitting procedure. An assignment such as ```r > ans <- lsfit(X, y) ``` gives the results of a least squares fit where `y` is the vector of observations and `X` is the design matrix. See the ...
### 5.7 Matrix facilities ------------------------------------------------------------------------
### 5.8 Forming partitioned matrices, `cbind()` and `rbind()` As we have already seen informally, matrices can be built up from other vectors and matrices by the functions `cbind()` and `rbind()`. Roughly `cbind()` forms matrices by binding together matrices horizontally, or column-wise, and `rbind()` vertically, or ro...
### 5.9 The concatenation function, `c()`, with arrays It should be noted that whereas `cbind()` and `rbind()` are concatenation functions that respect `dim` attributes, the basic `c()` function does not, but rather clears numeric objects of all `dim` and `dimnames` attributes. This is occasionally useful in its own ri...
### 5.10 Frequency tables from factors Recall that a factor defines a partition into groups. Similarly a pair of factors defines a two way cross classification, and so on. The function `table()` allows frequency tables to be calculated from equal length factors. If there are *k* factor arguments, the result is a *k*-wa...
## 6 Lists and data frames - [Lists](#Lists) - [Constructing and modifying lists](#Constructing-and-modifying-lists) - [Data frames](#Data-frames) ------------------------------------------------------------------------
### 6.1 Lists An R *list* is an object consisting of an ordered collection of objects known as its *components*. There is no particular need for the components to be of the same mode or type, and, for example, a list could consist of a numeric vector, a logical value, a matrix, a complex vector, a character array, a fu...
### 6.1 Lists Additionally, one can also use the names of the list components in double square brackets, i.e., `Lst[["name"]]` is the same as `Lst$name`. This is especially useful, when the name of the component to be extracted is stored in another variable as in ```r > x <- "name"; Lst[[x]] ``` It is very important to...
### 6.2 Constructing and modifying lists New lists may be formed from existing objects by the function `list()`. An assignment of the form ```r > Lst <- list(name_1=object_1, ..., name_m=object_m) ``` sets up a list `Lst` of *m* components using `object_1`, …, `object_m` for the components and giving them names as spec...
#### 6.2.1 Concatenating lists When the concatenation function `c()` is given list arguments, the result is an object of mode list also, whose components are those of the argument lists joined together in sequence. ```r > list.ABC <- c(list.A, list.B, list.C) ``` Recall that with vector objects as arguments the concate...
### 6.3 Data frames A *data frame* is a list with class `"data.frame"`. There are restrictions on lists that may be made into data frames, namely - The components must be vectors (numeric, character, or logical), factors, numeric matrices, lists, or other data frames. - Matrices, lists, and data frames provide as m...
#### 6.3.1 Making data frames Objects satisfying the restrictions placed on the columns (components) of a data frame may be used to form one using the function `data.frame`: ```r > accountants <- data.frame(home=statef, loot=incomes, shot=incomef) ``` A list whose components conform to the restrictions of a data frame ...
#### 6.3.2 `attach()` and `detach()` The `$` notation, such as `accountants$home`, for list components is not always very convenient. A useful facility would be somehow to make the components of a list or data frame temporarily visible as variables under their component name, without the need to quote the list name exp...
### 6.3 Data frames More precisely, this statement detaches from the search path the entity currently at position 2. Thus in the present context the variables `u`, `v` and `w` would be no longer visible, except under the list notation as `lentils$u` and so on. Entities at positions greater than 2 on the search path can...
#### 6.3.3 Working with data frames A useful convention that allows you to work with many different problems comfortably together in the same workspace is - gather together all variables for any well defined and separate problem in a data frame under a suitably informative name; - when working with a problem attach...
#### 6.3.4 Attaching arbitrary lists `attach()` is a generic function that allows not only directories and data frames to be attached to the search path, but other classes of object as well. In particular any object of mode `"list"` may be attached in the same way: ```r > attach(any.old.list) ``` Anything that has been...
#### 6.3.5 Managing the search path The function `search` shows the current search path and so is a very useful way to keep track of which data frames and lists (and packages) have been attached and detached. Initially it gives ```r > search() [1] ".GlobalEnv" "Autoloads" "package:base" ``` where `.GlobalEnv` is t...
## 7 Reading data from files Large data objects will usually be read as values from external files rather than entered during an R session at the keyboard. R input facilities are simple and their requirements are fairly strict and even rather inflexible. There is a clear presumption by the designers of R that you will ...
### 7.1 The `read.table()` function To read an entire data frame directly, the external file will normally have a special form. - The first line of the file should have a *name* for each variable in the data frame. - Each additional line of the file has as its first item a *row label* and the values for each variab...
### 7.1 The `read.table()` function Often you will want to omit including the row labels directly and use the default labels. In this case the file may omit the row label column as in the following. > <table class="cartouche" data-border="1"><colgroup><col style="width: 100%" /></colgroup><tbody><tr class="odd"><td><di...
### 7.2 The `scan()` function Suppose the data vectors are of equal length and are to be read in parallel. Further suppose that there are three vectors, the first of mode character and the remaining two of mode numeric, and the file is `input.dat`. The first step is to use `scan()` to read in the three vectors as a lis...
### 7.3 Accessing builtin datasets Around 100 datasets are supplied with R (in package **datasets**), and others are available in packages (including the recommended packages supplied with R). To see the list of datasets currently available use ```r data() ``` All the datasets supplied with R are available directly by ...
#### 7.3.1 Loading data from other R packages To access data from a particular package, use the `package` argument, for example ```r data(package="rpart") data(Puromycin, package="datasets") ``` If a package has been attached by `library`, its datasets are automatically included in the search. User-contributed packages...
### 7.4 Editing data When invoked on a data frame or matrix, `edit` brings up a separate spreadsheet-like environment for editing. This is useful for making small changes once a data set has been read. The command ```r > xnew <- edit(xold) ``` will allow you to edit your data set `xold`, and on completion the changed o...
## 8 Probability distributions - [R as a set of statistical tables](#R-as-a-set-of-statistical-tables) - [Examining the distribution of a set of data](#Examining-the-distribution-of-a-set-of-data) - [One- and two-sample tests](#One_002d-and-two_002dsample-tests) ---------------------------------------------------...
### 8.1 R as a set of statistical tables One convenient use of R is to provide a comprehensive set of statistical tables. Functions are provided to evaluate the cumulative distribution function P(X \<= x), the probability density function and the quantile function (given *q*, the smallest *x* such that P(X \<= x) \> q)...
### 8.1 R as a set of statistical tables Prefix the name given here by ‘`d`’ for the density, ‘`p`’ for the CDF, ‘`q`’ for the quantile function and ‘`r`’ for simulation (*r*andom deviates). The first argument is `x` for `dxxx`, `q` for `pxxx`, `p` for `qxxx` and `n` for `rxxx` (except for `rhyper`, `rsignrank` and `rw...
### 8.2 Examining the distribution of a set of data Given a (univariate) set of data we can examine its distribution in a large number of ways. The simplest is to examine the numbers. Two slightly different summaries are given by `summary` and `fivenum` and a display of the numbers by `stem` (a “stem and leaf” plot). `...
### 8.2 Examining the distribution of a set of data More elegant density plots can be made by `density`, and we added a line produced by `density` in this example. The bandwidth `bw` was chosen by trial-and-error as the default gives too much smoothing (it usually does for “interesting” densities). (Better automated me...
### 8.2 Examining the distribution of a set of data which will usually (if it is a random sample) show longer tails than expected for a normal. We can make a Q-Q plot against the generating distribution by ```r qqplot(qt(ppoints(250), df = 5), x, xlab = "Q-Q plot for t dsn") qqline(x) ``` Finally, we might want a more ...
### 8.3 One- and two-sample tests So far we have compared a single sample to a normal distribution. A much more common operation is to compare aspects of two samples. Note that in R, all “classical” tests including the ones used below are in package **stats** which is normally loaded. Consider the following sets of dat...
### 8.3 One- and two-sample tests which does indicate a significant difference, assuming normality. By default the R function does not assume equality of variances in the two samples. We can use the F test to test for equality in the variances, provided that the two samples are from normal populations. ```r > var.test(...
### 8.3 One- and two-sample tests Note the warning: there are several ties in each sample, which suggests strongly that these data are from a discrete distribution (probably due to rounding). There are several ways to compare graphically the two samples. We have already seen a pair of boxplots. The following ```r > plo...
## 9 Grouping, loops and conditional execution - [Grouped expressions](#Grouped-expressions) - [Control statements](#Control-statements) ------------------------------------------------------------------------
### 9.1 Grouped expressions R is an expression language in the sense that its only command type is a function or expression which returns a result. Even an assignment is an expression whose result is the value assigned, and it may be used wherever any expression may be used; in particular multiple assignments are possi...
### 9.2 Control statements - [Conditional execution: `if` statements](#Conditional-execution) - [Repetitive execution: `for` loops, `repeat` and `while`](#Repetitive-execution) ------------------------------------------------------------------------
#### 9.2.1 Conditional execution: `if` statements The language has available a conditional construction of the form ```r > if (expr_1) expr_2 else expr_3 ``` where `expr_1` must evaluate to a single logical value and the result of the entire expression is then evident. The “short-circuit” operators `&&` and `||` are of...
End of preview. Expand in Data Studio

R Programming Language Documentation

This dataset contains the R programming language documentation, chunked using semantic parsing for pretraining language models.

Updated: 2025-09-08

Loading

from datasets import load_dataset
ds = load_dataset("json", data_files={"train": "train.jsonl"}, split="train")

Statistics

  • Format: JSONL with single text field per line
  • Chunking: Semantic structure-aware chunking
  • Content: Official R documentation and manuals
Downloads last month
19

Collection including jusjinuk/r-manuals