Skip to content

Commit

Permalink
Edit Preface and Chapter aims, tweak page breaks.
Browse files Browse the repository at this point in the history
Rather minor edits to Preface and the Aims sections of each of the chapters. Update and/or add a couple index entries. Fix a couple of very minor typing. mistakes.
  • Loading branch information
aphalo committed Oct 22, 2019
1 parent aee3384 commit 5fbf0eb
Show file tree
Hide file tree
Showing 22 changed files with 262,670 additions and 262,111 deletions.
13 changes: 11 additions & 2 deletions R.as.calculator.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ The desire to economize time and mental effort in arithmetical computations, and

\section{Aims of this chapter}

In my experience, for those not familiar with computer programming languages, the best first step in learning the \Rlang language is to use it interactively by issuing textual commands at the \emph{console}. This will teach not only the syntax and grammar rules, but also give you a glimpse at the advantages and flexibility of this approach to data analysis.
In my experience, for those not familiar with computer programming languages, the best first step in learning the \Rlang language is to use it interactively by typing textual commands at the \emph{console} or command line. This will teach not only the syntax and grammar rules, but also give you a glimpse at the advantages and flexibility of this approach to data analysis.

In the first part of the chapter we will use \Rlang to do everyday calculations that should be so easy and familiar that you will not need to think about the operations themselves. This easy start will give you a chance to focus on learning how to issue textual commands at the command prompt.

Later in the chapter, you will gradually need to focus more on the \Rlang language and its grammar and less on how commands are entered. By the end of the chapter you will be familiar with most of the kinds of ``words'' used in the \Rlang language and you will be able to write simple ``sentences'' in \Rlang.

Along the chapter, I will show occasionally the equivalent of the \Rlang code in mathematical notation. If you are not familiar with the mathematical notation, you can safely ignore it, as long as you understand the \Rlang code.
Along the chapter, I will occasionally show the equivalent of the \Rlang code in mathematical notation. If you are not familiar with the mathematical notation, you can safely ignore it, as long as you understand the \Rlang code.

\section{Natural and computer languages}
\index{languages!natural and computer}
Expand Down Expand Up @@ -685,6 +685,9 @@ c(1L, 16L) %in% ((2L:4L) * (2L:4L))

<<sets-EB02>>=
length(integer())
@

<<sets-EB02a>>=
1L %in% integer()
setdiff(1L:4L, union(1L:4L, integer()))
@
Expand Down Expand Up @@ -1312,6 +1315,9 @@ Or alternatively by position changing only some level labels---i.e.\ rather unsa
<<factors-2c>>=
my.factor1 <- gl(4, 3, labels = c("A", "F", "B", "Z"))
my.factor1
@

<<factors-2cc>>=
levels(my.factor1)[c(1, 4)] <- c("a", "d")
my.factor1
@
Expand Down Expand Up @@ -1631,6 +1637,9 @@ x.list <- list(abcd = 123, xyzw = 789)
x.list[["abcd"]]
a.var <- "abcd"
x.list[[a.var]]
@

<<index-partial-1a>>=
x.list$abcd
x.list$ab
x.list$a
Expand Down
4 changes: 2 additions & 2 deletions R.data.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Essentially everything in S[R], for instance, a call to a function, is an S[R] o

\section{Aims of this chapter}

Base \Rlang and the recommended packages (installed by default) include many functions for manipulating data. This is a complete set, that supports all the usually needed operations. These functions have stable and well described behaviour, so they should be preferred unless some of their limitations justify the use of alternatives defined in contributed packages. In the present chapter we aim at describing the new syntaxes introduced by the most popular of these extensions aiming at changing (usually improving one aspect at the expense of another) in various ways how we can manipulate data in \Rlang.
Base \Rlang and the recommended extension packages (installed by default) include many functions for manipulating data. The \Rlang distribution supplies a complete set of functions and operators that allow all the usual data manipulation operations. These functions have stable and well described behaviour, so they should be preferred unless some of their limitations justify the use of alternatives defined in contributed packages. In the present chapter we aim at describing the new syntaxes introduced by the most popular of these contributed \Rlang extension packages aiming at changing (usually improving one aspect at the expense of another) in various ways how we can manipulate data in \Rlang. These independently developed packages extend the \Rlang language not only by adding new `words' to it but by supporting new ways of meaningfully connecting `words'---i.e.\ providing new `grammars' for data manipulation.

\section{Introduction}

Expand Down Expand Up @@ -459,7 +459,7 @@ tibble(numbers = 1:9, letters = rep(letters[1:3], 3)) %.>%
@

\begin{warningbox}
\textbf{How is grouping implemented for data frames and tibbles?}\index{grouping!implementation in tidyverse} In our case as our tibble belongs to class \code{tibble\_df}, grouping adds \code{grouped\_df} as the most derived class. It also adds several attributes with the grouping information in a format suitable for fast selection of group members. To demonstrate this, we need to make an exception to our recommendation above and save a grouped tibble to a variable.
How is grouping implemented for data frames and tibbles?\index{grouping!implementation in tidyverse} In our case as our tibble belongs to class \code{tibble\_df}, grouping adds \code{grouped\_df} as the most derived class. It also adds several attributes with the grouping information in a format suitable for fast selection of group members. To demonstrate this, we need to make an exception to our recommendation above and save a grouped tibble to a variable.

<<tibble-grouped-box-01>>=
my.tb <- tibble(numbers = 1:9, letters = rep(letters[1:3], 3))
Expand Down
4 changes: 2 additions & 2 deletions R.data.io.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ eval_yoctopuce <- TRUE

\section{Aims of this chapter}

Base \Rlang and the recommended packages (installed by default) include several functions for importing and exporting data. Contributed packages provide both replacements for some of these functions and support for several additional file formats. In the present chapter I aim at describing both data input and output covering in detail only the most common ``foreign'' data formats.
Base \Rlang and the recommended packages (installed by default) include several functions for importing and exporting data. Contributed packages provide both replacements for some of these functions and support for several additional file formats. In the present chapter I aim at describing both data input and output covering in detail only the most common ``foreign'' data formats (those not native to \Rlang).

Developing software to read and write files with data stored in a format one does not have control on, or possibly a format one even needs to guess, can easily result in long, messy, ugly \Rlang scripts. It is also easy to end with functions that usually work but that fail with specific files, or even worse, occasionally silently corrupt the read data. Our aim is to provide guidance for finding available functions from base \Rlang and contributed packages that are well tested or validated.
Data file formats foreign to \Rlang are not always well defined, making it necessary to reverse-engineer the algorithms need to read them. These formats, even when clearly defined, may be updated by the developers of the foreign software that writes the files. Consequently, developing software to read and write files using foreign formats can easily result in long, messy, and ugly \Rlang scripts. We can also unwillingly write code that usually works but occasionally fails with specific files, or even worse, occasionally silently corrupts the imported data. The aim of this chapter is to provide guidance for finding functions for reading data encoded using foreign formats, covering both base \Rlang, including the \pkgname{foreign} package, and independently contributed packages. Such functions are well tested or validated.

In this chapter you will familiarise with how to exchange data between \Rlang and other applications. The functions \code{save()} and \code{load()}, and \code{saveRDS()} and \code{readRDS()} all of which save and read data in \Rlang's native format are described in sections \ref{sec:data:rda} and \ref{sec:data:rds} starting on page \pageref{sec:data:rda}.

Expand Down
Loading

0 comments on commit 5fbf0eb

Please sign in to comment.