Top Banner
What is R? Why/Why not R? Practical Issues. Basic Examples Markdown Decisions, Roadmap & Comparisons Coming Up R TUTORIAL - PHI (Session 1) Oguzhan (Ouz) Gencoglu Department of Signal Processing Tampere University of Technology, Finland Personal Health Informatics Team, October 2014 Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)
58

R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

Aug 10, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

R TUTORIAL - PHI (Session 1)

Oguzhan (Ouz) Gencoglu

Department of Signal ProcessingTampere University of Technology, Finland

Personal Health Informatics Team, October 2014

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 2: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Outline

1 What is R? Why/Why not R? Practical Issues.What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

2 Basic ExamplesAssignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

3 MarkdownWhat is a Markdown file?Markdown Example

4 Decisions, Roadmap & Comparisons

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 3: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

Outline

1 What is R? Why/Why not R? Practical Issues.What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

2 Basic ExamplesAssignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

3 MarkdownWhat is a Markdown file?Markdown Example

4 Decisions, Roadmap & Comparisons

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 4: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.What exactly is this R thing?

R is a language and environment for statistical computing andgraphics. It provides a wide variety of statistical (linear andnonlinear modeling, classical statistical tests, time-series analysis,classification, clustering, ...) and graphical techniques, and ishighly extensible.

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 5: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

Outline

1 What is R? Why/Why not R? Practical Issues.What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

2 Basic ExamplesAssignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

3 MarkdownWhat is a Markdown file?Markdown Example

4 Decisions, Roadmap & Comparisons

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 6: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

Free (Speech & Sandwich)

Most comprehensivestatistical analysisenvironment

Maintained by manystatisticians, scientists

Outstanding graphicalcapabilities

Almost 5000 packages

Cross-platform

Active user group

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 7: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

Free (Speech & Sandwich)

Most comprehensivestatistical analysisenvironment

Maintained by manystatisticians, scientists

Outstanding graphicalcapabilities

Almost 5000 packages

Cross-platform

Active user group

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 8: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

Free (Speech & Sandwich)

Most comprehensivestatistical analysisenvironment

Maintained by manystatisticians, scientists

Outstanding graphicalcapabilities

Almost 5000 packages

Cross-platform

Active user group

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 9: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

Free (Speech & Sandwich)

Most comprehensivestatistical analysisenvironment

Maintained by manystatisticians, scientists

Outstanding graphicalcapabilities

Almost 5000 packages

Cross-platform

Active user group

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 10: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

Free (Speech & Sandwich)

Most comprehensivestatistical analysisenvironment

Maintained by manystatisticians, scientists

Outstanding graphicalcapabilities

Almost 5000 packages

Cross-platform

Active user group

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 11: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

Free (Speech & Sandwich)

Most comprehensivestatistical analysisenvironment

Maintained by manystatisticians, scientists

Outstanding graphicalcapabilities

Almost 5000 packages

Cross-platform

Active user group

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 12: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

Free (Speech & Sandwich)

Most comprehensivestatistical analysisenvironment

Maintained by manystatisticians, scientists

Outstanding graphicalcapabilities

Almost 5000 packages

Cross-platform

Active user group

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 13: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

/ Learning Curve

/ Memory and Speed Issuesfor certain tasks

/ Ugly syntax (my opinion)- compare Python

/ Documentation style

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 14: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

/ Learning Curve

/ Memory and Speed Issuesfor certain tasks

/ Ugly syntax (my opinion)- compare Python

/ Documentation style

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 15: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

/ Learning Curve

/ Memory and Speed Issuesfor certain tasks

/ Ugly syntax (my opinion)- compare Python

/ Documentation style

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 16: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.The Good, The Bad & the Ugly (Sides of R)

/ Learning Curve

/ Memory and Speed Issuesfor certain tasks

/ Ugly syntax (my opinion)- compare Python

/ Documentation style

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 17: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

Outline

1 What is R? Why/Why not R? Practical Issues.What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

2 Basic ExamplesAssignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

3 MarkdownWhat is a Markdown file?Markdown Example

4 Decisions, Roadmap & Comparisons

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 18: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.Starting the Journey

R - http://ftp.sunet.se/pub/lang/CRAN/

RStudio IDE - http://www.rstudio.com/

Case sensitive

Expressions are printed, assignments not

Assigning with <- (or ->)

Commenting with #

Indexing starts from 1

NaN (not a number), NA (not available)

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 19: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.Starting the Journey

R - http://ftp.sunet.se/pub/lang/CRAN/

RStudio IDE - http://www.rstudio.com/

Case sensitive

Expressions are printed, assignments not

Assigning with <- (or ->)

Commenting with #

Indexing starts from 1

NaN (not a number), NA (not available)

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 20: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.Starting the Journey

R - http://ftp.sunet.se/pub/lang/CRAN/

RStudio IDE - http://www.rstudio.com/

Case sensitive

Expressions are printed, assignments not

Assigning with <- (or ->)

Commenting with #

Indexing starts from 1

NaN (not a number), NA (not available)

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 21: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.Starting the Journey

R - http://ftp.sunet.se/pub/lang/CRAN/

RStudio IDE - http://www.rstudio.com/

Case sensitive

Expressions are printed, assignments not

Assigning with <- (or ->)

Commenting with #

Indexing starts from 1

NaN (not a number), NA (not available)

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 22: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.Starting the Journey

R - http://ftp.sunet.se/pub/lang/CRAN/

RStudio IDE - http://www.rstudio.com/

Case sensitive

Expressions are printed, assignments not

Assigning with <- (or ->)

Commenting with #

Indexing starts from 1

NaN (not a number), NA (not available)

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 23: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.Starting the Journey

R - http://ftp.sunet.se/pub/lang/CRAN/

RStudio IDE - http://www.rstudio.com/

Case sensitive

Expressions are printed, assignments not

Assigning with <- (or ->)

Commenting with #

Indexing starts from 1

NaN (not a number), NA (not available)

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 24: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.Starting the Journey

R - http://ftp.sunet.se/pub/lang/CRAN/

RStudio IDE - http://www.rstudio.com/

Case sensitive

Expressions are printed, assignments not

Assigning with <- (or ->)

Commenting with #

Indexing starts from 1

NaN (not a number), NA (not available)

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 25: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

What is R? Why/Why not R? Practical Issues.Starting the Journey

R - http://ftp.sunet.se/pub/lang/CRAN/

RStudio IDE - http://www.rstudio.com/

Case sensitive

Expressions are printed, assignments not

Assigning with <- (or ->)

Commenting with #

Indexing starts from 1

NaN (not a number), NA (not available)

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 26: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Outline

1 What is R? Why/Why not R? Practical Issues.What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

2 Basic ExamplesAssignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

3 MarkdownWhat is a Markdown file?Markdown Example

4 Decisions, Roadmap & Comparisons

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 27: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Assignment, Lists, Arrays etc.

introduction.Rcontrol structures.R

Assignment

Indexing

Arrays

List

Control structures

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 28: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Assignment, Lists, Arrays etc.

introduction.Rcontrol structures.R

Assignment

Indexing

Arrays

List

Control structures

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 29: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Assignment, Lists, Arrays etc.

introduction.Rcontrol structures.R

Assignment

Indexing

Arrays

List

Control structures

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 30: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Assignment, Lists, Arrays etc.

introduction.Rcontrol structures.R

Assignment

Indexing

Arrays

List

Control structures

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 31: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Assignment, Lists, Arrays etc.

introduction.Rcontrol structures.R

Assignment

Indexing

Arrays

List

Control structures

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 32: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Outline

1 What is R? Why/Why not R? Practical Issues.What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

2 Basic ExamplesAssignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

3 MarkdownWhat is a Markdown file?Markdown Example

4 Decisions, Roadmap & Comparisons

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 33: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Data Frames

data frames.R

Creating DFs

Using DFs

Aggregation

Reshaping

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 34: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Data Frames

data frames.R

Creating DFs

Using DFs

Aggregation

Reshaping

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 35: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Data Frames

data frames.R

Creating DFs

Using DFs

Aggregation

Reshaping

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 36: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Data Frames

data frames.R

Creating DFs

Using DFs

Aggregation

Reshaping

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 37: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Outline

1 What is R? Why/Why not R? Practical Issues.What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

2 Basic ExamplesAssignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

3 MarkdownWhat is a Markdown file?Markdown Example

4 Decisions, Roadmap & Comparisons

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 38: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

‘apply’ functions

apply functions.R

lapply

sapply

tapply

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 39: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

‘apply’ functions

apply functions.R

lapply

sapply

tapply

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 40: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

‘apply’ functions

apply functions.R

lapply

sapply

tapply

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 41: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Outline

1 What is R? Why/Why not R? Practical Issues.What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

2 Basic ExamplesAssignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

3 MarkdownWhat is a Markdown file?Markdown Example

4 Decisions, Roadmap & Comparisons

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 42: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Statistical Tools

Prefix d for density value (pdf)

Prefix p for cumulative probability (cdf)

Prefix q for quantile values

Prefix r for random values from the distribution

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 43: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Statistical Tools

Prefix d for density value (pdf)

Prefix p for cumulative probability (cdf)

Prefix q for quantile values

Prefix r for random values from the distribution

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 44: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Statistical Tools

Prefix d for density value (pdf)

Prefix p for cumulative probability (cdf)

Prefix q for quantile values

Prefix r for random values from the distribution

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 45: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Assignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

Statistical Tools

Prefix d for density value (pdf)

Prefix p for cumulative probability (cdf)

Prefix q for quantile values

Prefix r for random values from the distribution

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 46: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What is a Markdown file?Markdown Example

Outline

1 What is R? Why/Why not R? Practical Issues.What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

2 Basic ExamplesAssignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

3 MarkdownWhat is a Markdown file?Markdown Example

4 Decisions, Roadmap & Comparisons

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 47: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What is a Markdown file?Markdown Example

What is a Markdown file?

R Markdown enables easy authoring of reproducible web reportsfrom R. It offers:

Easy creation of web reports from R that can be automaticallyregenerated whenever underlying code or data changes.

A highly accessible syntax (markdown) which lower thebarriers to entry for reproducible research.

Output of a standalone HTML file (with images embeddeddirectly in the file) that is easy to share using email, Dropbox,or by deploying to a web server.

Support for publishing dynamic and interactive web content.

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 48: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What is a Markdown file?Markdown Example

What is a Markdown file?

R Markdown enables easy authoring of reproducible web reportsfrom R. It offers:

Easy creation of web reports from R that can be automaticallyregenerated whenever underlying code or data changes.

A highly accessible syntax (markdown) which lower thebarriers to entry for reproducible research.

Output of a standalone HTML file (with images embeddeddirectly in the file) that is easy to share using email, Dropbox,or by deploying to a web server.

Support for publishing dynamic and interactive web content.

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 49: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What is a Markdown file?Markdown Example

What is a Markdown file?

R Markdown enables easy authoring of reproducible web reportsfrom R. It offers:

Easy creation of web reports from R that can be automaticallyregenerated whenever underlying code or data changes.

A highly accessible syntax (markdown) which lower thebarriers to entry for reproducible research.

Output of a standalone HTML file (with images embeddeddirectly in the file) that is easy to share using email, Dropbox,or by deploying to a web server.

Support for publishing dynamic and interactive web content.

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 50: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What is a Markdown file?Markdown Example

What is a Markdown file?

R Markdown enables easy authoring of reproducible web reportsfrom R. It offers:

Easy creation of web reports from R that can be automaticallyregenerated whenever underlying code or data changes.

A highly accessible syntax (markdown) which lower thebarriers to entry for reproducible research.

Output of a standalone HTML file (with images embeddeddirectly in the file) that is easy to share using email, Dropbox,or by deploying to a web server.

Support for publishing dynamic and interactive web content.

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 51: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What is a Markdown file?Markdown Example

What is a Markdown file?

R Markdown enables easy authoring of reproducible web reportsfrom R. It offers:

Easy creation of web reports from R that can be automaticallyregenerated whenever underlying code or data changes.

A highly accessible syntax (markdown) which lower thebarriers to entry for reproducible research.

Output of a standalone HTML file (with images embeddeddirectly in the file) that is easy to share using email, Dropbox,or by deploying to a web server.

Support for publishing dynamic and interactive web content.

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 52: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What is a Markdown file?Markdown Example

Outline

1 What is R? Why/Why not R? Practical Issues.What exactly is this R thing?The Good, The Bad & the Ugly (Sides of R)Practical Issues

2 Basic ExamplesAssignment, Lists, Arrays etc.Data Frames‘apply’ functionsStatistical Tools

3 MarkdownWhat is a Markdown file?Markdown Example

4 Decisions, Roadmap & Comparisons

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 53: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

What is a Markdown file?Markdown Example

Markdown Example

0.0

0.1

0.2

0.3

−3 0 3values

dens

ity

type

1

2

3

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 54: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Decisions, Roadmap & Comparisons

Task Language (software)

Exploratory Analysis R

Casual Publishing R

Filter Design MATLAB

Casual Plotting MATLAB/Python/R

Simple Numeric Matrix MATLAB/Python/R

Many Plots Python

Error Handling Python

Formal Plotting R

Machine Learning Python/(R)

Roadmap

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 55: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Decisions, Roadmap & Comparisons

Task Language (software)

Image Processing MATLAB

Memory Python

Pure Speed C++

Object Oriented Programming C++/Python

Garbage Collection Python

String Processing Python/Perl

GPU Python

Parallel Processing Python

Roadmap

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 56: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Decisions, Roadmap & Comparisons

Task Language (software)

Biomedical Signal Processing MATLAB/Python/R

Dynamic Plotting Python

Neat Coding Python

Own License and Library Python/R

Contribution Externally Python

Simple GUI MATLAB

Having Fun Whatever floats your boat

Roadmap

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 57: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Coming Up

ACKBAR BEN BIGGS CREATURE EMPEROR GOLD LEADER HAN JABBA LANDO LEIA LUKE OWEN PIETT RED LEADER TARKIN THREEPIO TROOPER VADER WEDGE YODA

star

death

attack

shield

luke

force

will

can

father

jedi

side

vader

emperor

became

luke

going

back

get

just

one

pull

right

side

jedi

mine

come

eat

will

will

now

young

friends

skywalker

side

can

good

dark

fleet

leader

gold

get

chewie

going

got

come

well

right

like

kid

hey

will

han

right

get

vader

han

fighters

chewie

leia

lord

shield

star

luke

get

know

come

kenobi

going

help

hope

chewie

obiwan

know

going

right

come

back

can

just

well

got

father

luke

one

take

need

lord

yes

vader

red

copy

just

will

rebel

station

vader

yes

sir

artoo

master

going

luke

think

wait

jabba

help

sure

right

blast

will

ship

now

can

obiwan

admiral

skywalker

master

emperor

force

leader

red

two

will

force

yes

must

dark

jedi

mind

now

Star Wars: Character DialoguesArc−diagram

Episodes

IVVVI

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)

Page 58: R TUTORIAL - PHI (Session 1) · The Good, The Bad & the Ugly (Sides of R) Practical Issues What is R? Why/Why not R? Practical Issues. The Good, The Bad & the Ugly (Sides of R) Free

What is R? Why/Why not R? Practical Issues.Basic Examples

MarkdownDecisions, Roadmap & Comparisons

Coming Up

Questions / Comments ?

Oguzhan (Ouz) Gencoglu R TUTORIAL - PHI (Session 1)