Жанры
Авторы
Контакты
О сайте
Книжные новинки
Популярные книги
Найти
Главная
Авторы
Philippe J. S. De Brouwer
The Big R-Book
Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 1
Оглавление
Предыдущая
Следующая
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
297
Оглавление
Купить и скачать книгу
Вернуться на страницу книги The Big R-Book
Оглавление
Страница 1
Table of Contents
List of Tables
List of Illustrations
Guide
Pages
THE BIG R-BOOK FROM DATA SCIENCE TO LEARNING MACHINES AND BIG DATA
Страница 8
Страница 9
Foreword
About the Companion Site
About the Author
Preface
Acknowledgements
Страница 15
Страница 16
Страница 17
♣3♣ Conventions
Listing 3.1
: This is what you would see if you start R in the command line terminal. Note that the last sign is the R-prompt, inviting you to type commands. This code fragment is typical for how code that is not in the R-language has been typeset in this book.
Listing 3.2
: Another example of a command line instructions: factor, calc, and pi. This example only has CLI code and does not start R.
Question #1 Histogram
Definition: This is a definition
Function use for mean()
Example: Mean
Example: Mean
Hint – Using the hint boxes
Note – Layout details
Digression – This is good to know
Warning – Read comments in code
Note – Shadow
Notes
Страница 32
♣4♣ The Basics of R
Hint – Getting more help
4.1 Getting Started with R
Hint – Using R Online
RStudio
Hint – RStudio is free
Basic arithmetic
Hint – White space
Editing variables interactively
Further information – Other ways to import data
Warning – Using CLI tools
Batch mode
4.2. Variables
Assignment
Variable Management
Note – What are invisible variables
4.3 Data Types
4.3.1 The Elementary Types
Warning – Changing data types
Dates
Further information –More about dates
4.3.2 Vectors 4.3.2.1 Creating Vectors
4.3.3 Accessing Data from a Vector
4.3.3.1 Vector Arithmetic
Warning – Not all operations are element per element
4.3.3.2 Vector Recycling
Warning – Vector recycling
4.3.3.3 Reordering and Sorting
Question #2 Temperature conversion
Hint – Addressing the object nottem
4.3.4 Matrices
4.3.4.1 Creating Matrices
4.3.4.2 Naming Rows and Columns
4.3.4.3 Access Subsets of a Matrix
4.3.4.4 Matrix Arithmetic
Question #3 Dot product
Note – Percentage signs point towards matrix operations
Warning – R consistently works element by element
4.3.5 Arrays
4.3.5.1 Creating and Accessing Arrays
4.3.5.2 Naming Elements of Arrays
4.3.5.3 Manipulating Arrays
4.3.5.4 Applying Functions over Arrays
Function use for apply()
4.3.6 Lists
4.3.6.1 Creating Lists
Definition: List
Further information – Object-oriented programming in R
4.3.6.2 Naming Elements of Lists
4.3.6.3 List Manipulations
Lists of Lists Are Also Lists
Further information – Double square brackets
Add and Delete Elements of a List
Warning – Deleting elements in lists
Convert list to vectors
Warning – Silent failing of unlist()
4.3.7 Factors
4.3.7.1 Creating Factors
Digression – The reduced importance of factors
4.3.7.2 Ordering Factors
Generate Factors with the Function gl() Function use for gl()
Question #4
Question #5
Question #6
4.3.8 Data Frames 4.3.8.1 Introduction to Data Frames
4.3.8.2 Accessing Information from a Data Frame
Warning – Avoiding conversion to factors
4.3.8.3 Editing Data in a Data Frame
4.3.8.4 Modifying Data Frames Add Columns to a Data-frame
Adding Rows to a Data-frame
Merging data frames
Short-cuts
Warning – Short-cuts can be dangerous
Naming Rows and Columns
Question #7
4.3.9 Strings or the Character-type
Example: Using strings
Note – Paste
Formatting with
Function use for format()
Formatting examples
Further information – format()
Other string functions
4.4 Operators
4.4.1 Arithmetic Operators
Warning – Element-wise operations in R
4.4.2 Relational Operators
4.4.3 Logical Operators
Note – Numeric equivalent and logical evalutation
4.4.4 Assignment Operators
Hint – Assignment
Digression – For C++ programmers
Warning – Sparingly change variables in other environments
4.4.5 Other Operators
Warning – Redefine existing operators
4.5 Flow Control Statements
4.5.1 Choices 4.5.1.1 The if-Statement
Function use for if()
Hint – Extending the if-statement
4.5.1.2 The Vectorised If-statement
4.5.1.3 The Switch-statement
4.5.2 Loops
4.5.2.1 The For Loop
Function use for for()
Example: For loop
Note – No counter in the for loop
4.5.2.2 Repeat
Function use for repeat()
Example: Repeat loop
Warning – Break out of he repeat loop
4.5.2.3 While
Function use for while()
Example: While loop
4.5.2.4 Loop Control Statements
Digression – The speed of loops
Further information – Speed
4.6 Functions
4.6.1 Built-in Functions
4.6.2 Help with Functions
Help with functions
Further information on packages
4.6.3 User-defined Functions
Function use for function()
Example: A bespoke function
4.6.4 Changing Functions
Hint
4.6.5 Creating Function with Default Arguments
Example
Example: default value for function
4.7 Packages
4.7.1 Discovering Packages in R
Example: loading the package DiagrammeR
Further information – Packages
Useful functions for packages
Further information – All available packages
Further information – All installed packages
4.7.2 Managing Packages in R
Note – Cold code in this section
4.8 Selected Data Interfaces
4.8.1 CSV Files
Hint – Reading files directly from the Internet
Finding data
Writing to a CSV file
Warning – Silently added rows
4.8.2 Excel Files
4.8.3 Databases
Connecting to the Database
Fetching Data Drom a Database
Update Queries
Create Tables from R Data-frames
Warning – Closing the database connection
Notes
Страница 185
♣6♣ The Implementation of OO
6.1. Base Types
6.2. S3 Objects
Hint – Naming conventions
6.2.1 Creating S3 Objects
6.2.2 Creating Generic Methods
6.2.3 Method Dispatch
Note – Avoid direct calls
Hint – Speed gain
6.2.4 Group Generic Functions
Note – Distinguish groups and functions
Hint – Find what is the next method
6.3. S4 Objects
Hint – Loading the library methods
6.3.1 Creating S4 Objects
Note – Difference between inheritance and methods
6.3.2 Using S4 Objects
Note – Compare addressing slots in S4 and S3
Warning – Partialmatching
Hint – Alternative to address slots
Question #8
Question #9
Hint – List all slots
6.3.3 Validation of Input
Warning – Silent setting to default
Warning – Changing class definitions at runtime
Hint – Locking a class definition
Hint – Typesetting conventions
6.3.4 Constructor functions
Hint – Calling the constructor function
6.3.5 The .Data slot
6.3.6 Recognising Objects, Generic Functions, and Methods
Note – Nuances in the OO system
6.3.7 Creating S4 Generics
Warning – Overloading functions
6.3.8 Method Dispatch
6.4. The Reference Class, refclass, RC or R5 Model
Note – Recent developments
6.4.1 Creating RC Objects
Note
Hint
Note – Assigning in the encapsulating environment
Note – Addressing attributes and methods
Note – No dynamic editing of field definitions
6.4.2 Important Methods and Attributes
6.5. Conclusions about the OO Implementation
Digression – R6
Notes
♣7♣ Tidy R with the Tidyverse 7.1. The Philosophy of the Tidyverse
Tidy Data
Tidy Conventions
Further information – Tidyverse philosophy
7.2. Packages in the Tidyverse
Digression – Calling methods of not loaded packages
7.2.1 The Core Tidyverse
7.2.2 The Non-core Tidyverse
Warning –Work in progress
7.3. Working with the Tidyverse 7.3.1 Tibbles
Digression – Special characters in column names
Hint
Digression – Changing how a tibble is printed
Hint – Viewing the content of a tibble
7.3.2 Piping with R
Example: – Pipe operator
Hint – Pronouncing the pipe
Note – Equivalence of piping and nesting
7.3.3 Attention Points When Using the Pipe
Further information – Error catching
7.3.4 Advanced Piping 7.3.4.1 The Dollar Pipe
Note – Using functions without brackets
7.3.4.2 The T-Pipe
7.3.4.3 The Assignment Pipe
Warning – Assignment pipe
7.3.5 Conclusion
Hint – Use pipes sparingly
Notes
♣8♣ Elements of Descriptive Statistics
8.1. Measures of Central Tendency
8.1.1 Mean
8.1.1.1 The Arithmetic Mean
Definition: Arithmetic mean
Hint – Outliers
8.1.1.2 Generalised Means
Definition: f-mean
The Power Mean
Example: Whichmeanmakes most sense?
8.1.2 The Median
8.1.3 The Mode
Hint – Use default values to keep code backwards compatible
8.2. Measures of Variation or Spread
Definition: Variance
8.2.1 Standard Deviation Definition: Standard deviation
8.2.2 Median absolute deviation Definition: mad
8.3. Measures of Covariation
8.3.1 8.3.1 The Pearson Correlation
8.3.2 8.3.2 The Spearman Correlation
Question #10
Warning – Correlation is more specific than relation
8.3.3 Chi-square Tests
Chi-Square test in R Function use for chisq.test()
8.4. Distributions
8.4.1 Normal Distribution
The Normal Distribution in R
Illustrating the Normal Distribution
Case Study: Returns on the Stock Exchange
8.4.2 Binomial Distribution
The Binomial Distribution in R
An Example of the Binomial Distribution
8.5. Creating an Overview of Data Characteristics
Note – A tibble is a special form of data-frame
Notes
{buyButton}
Подняться наверх