Kiwi.mendelu.cz



Quick R



Data Types 7

Vectors 7

Matrices 7

Arrays 7

Dataframes 7

Lists 8

Factors 8

Useful Functions 9

Importing Data 9

From A Comma Delimited Text File 9

From Excel 9

From SPSS 10

From SAS 10

From Stata 10

From systat 10

Keyboard Input 10

ccess to Database Management Systems (DBMS) 11

ODBC Interface 11

Other Interfaces 11

Exporting Data 12

To A Tab Delimited Text File 12

To an Excel Spreadsheet 12

To SPSS 12

To SAS 12

To Stata 12

Getting Information on a Dataset 12

Variable Labels 13

Value Labels 13

Missing Data 14

Testing for Missing Values 14

Recoding Values to Missing 14

Excluding Missing Values from Analyses 14

Advanced Handling of Missing Data 15

Date Values 15

Date Conversion 16

Learning More 16

Creating new variables 16

Recoding variables 16

Renaming variables 17

Operators 17

Arithmetic Operators 17

Logical Operators 18

Built-in Functions 18

Numeric Functions 18

Character Functions 19

Statistical Probability Functions 20

Other Statistical Functions 21

Other Useful Functions 22

Control Structures 22

if-else 22

for 22

while 22

switch 22

ifelse 22

Example 23

User-written Functions 23

Sorting Data 24

Merging Data 24

Adding Columns 24

Adding Rows 25

Aggregating Data 25

Reshaping Data 25

Transpose 25

Reshape Package 25

Subsetting Data 27

Selecting (Keeping) Variables 27

Excluding (DROPPING) Variables 27

Selecting Observerations 28

Selection using the Subset Function 28

Random Samples 28

Going Further 28

Data Type Conversion 28

Examples 29

Dates 29

Descriptive Statistics 29

Summary Statistics by Group 30

Frequencies and Crosstabs 30

Generating Frequency Tables 31

Tests of Independence 32

Measures of Association 33

Visualizing results 33

Converting Frequency Tables to an "Original" Flat file 33

Correlations 33

Other Types of Correlations 34

Visualizing Correlations 34

t-tests 35

Visualizing Results 35

Nonparametric Tests of Group Differences 35

Visualizing Results 36

Multiple (Linear) Regression 36

Fitting the Model 36

Diagnostic Plots 36

Comparing Models 37

Cross Validation 37

Variable Selection 38

Relative Importance 39

Graphic Enhancements 40

Going Further 41

Regression Diagnostics 41

Outliers 41

Influential Observations 42

Non-normality 44

Non-constant Error Variance 45

Multi-collinearity 46

Nonlinearity 46

Non-independence of Errors 47

Additional Diagnostic Help 47

Going Further 48

ANOVA 48

Multiple Comparisons 49

Visualizing Results 49

MANOVA 51

Going Further 52

Assessing Classical Test Assumptions 52

Outliers 52

Univariate Normality 53

Multivariate Normality 54

Homogeneity of Variances 55

Homogeneity of Covariance Matrices 57

Resampling Statistics 57

Independent Two- and K-Sample Location Tests 57

symmetry of a response for repeated measurements 57

Independence of Two Numeric Variables 57

Independence in Contingency Tables 58

Power Analysis 58

Overview 58

Power Analysis in R 58

t-tests 59

ANOVA 60

Correlations 60

Linear Models 60

Tests of Proportions 61

Chi-square Tests 61

some Examples 62

Creating Power or Sample Size Plots 62

Using with( ) and by( ) 64

With 64

By 64

Generalized Linear Models 64

Logistic Regression 65

Poisson Regression 66

Survival Analysis 66

Discriminant Function Analysis 67

Linear Discriminant Function 67

Quadratic Discriminant Function 68

Visualizing the Results 68

Test Assumptions 72

Bootstrapping 72

Nonparametric Bootstrapping 72

Going Further 76

Learning More 77

Matrix Algebra 77

Matrix facilites 77

Matlab Emulation 78

Going Further 78

Creating a Graph 79

Saving Graphs 79

Viewing Several Graphs 80

Graphical Parameters 80

Histograms and Density Plots 81

Histograms 81

Kernal Density Plots 82

Comparing Groups VIA Kernal Density 82

Dot Plots 83

Going Further 85

Bar Plots 85

Simple Bar Plot 86

Stacked Bar Plot 86

Grouped Bar Plot 87

Notes 87

Line Charts 87

Pie Charts 92

Simple Pie Chart 92

Pie Chart with Annotated Percentages 92

3D Pie Chart 92

Creating Annotated Pies from a Dataframe 93

Boxplots 93

Other Options 94

Violin Plots 95

Bagplot - A 2D Boxplot Extension 95

Scatterplots 96

Simple Scatterplot 96

Scatterplot Matrices 98

High Density Scatterplots 102

3D Scatterplots 104

Graphical Parameters 109

Text and Symbol Size 110

Plotting Symbols 110

Lines 111

colors 111

fonts 113

Margins and Graph Size 114

Going Further 114

Axes and Text 114

Titles 114

Text Annotations 115

Axes 116

Reference Lines 119

Legend 119

Combining Plots 120

creating a figure arrangement with fine control 122

Trellis Graphs 123

Customizing Trellis Graphs 128

Going Further 129

Probability Plots 129

Probability Plots for Teaching and Demonstration 129

Fitting Distributions 132

Visualizing Categorical Data 134

Mosaic Plots 134

Association Plots 134

Going Further 135

Correlograms 135

Changing the colors in a correlogram 139

Interactive Graphics 140

GGobi 140

iPlots 141

Interacting with Plots (Indentifying Points) 142

Other Interactive Graphs 142

Data Types

R has a wide variety of data types including scalars, vectors (numerical, character, logical), matrices, dataframes, and lists.

Vectors

a ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download