Full screen

Share

Show pages

Current Trends & Issues
Want to create interactive content? It’s easy in Genially!

Over 30 million people create interactive content in Genially

Check out what others have designed:

Transcript

Presented by:John Lorenz Lacaba Mariel Arguta Noreen Rabi

R LANGUAGE

Current Trends & Issues

INDEX

R Data Structure

R Math

R Operators

R Basic Data Types

Introduction

R Packages

R Environment

Environment Setup

Brief History

R Variables

R Language

01

Let's get to know R a bit

INTRODUCTION.R

  • R is a language and environment for statistical computing and graphics
  • It’s an open-source programming language often used as a data analysis and statistical software tool

R Language

What is R?

Platform Independent

Latest Cutting Edge Technology

Integrate with other languages

Free Installation

Hottest Trend

Vast Community

Why R?

R Language

Tech giants like Google, Facebook, bing, Twitter, Accenture, Wipro and many more using R nowadays.

R is the most prevalent language.

R is used by many quantitative analysts as its programming tool.

Applications of R:

R Applications

We use R for Data Science.

02

Let's get to know R a bit

HISTORY.R

1993

Announcement of R to the public

1991

Developed R by Ross Ihaka and Robert Gentleman

1976

Statistical programming Language S was developed at Bell Labs

2000

R Version 1.0.0 releases

1997

R core group team is formed who controls the source code of R

1995

R got GNU General Public License and become free software.

R Hustory

03

R Environment Setup

SETUP.R

+INFO

R Environment Setup

The R Project for Statistical Computing

+INFO

R Environment Setup

+INFO

R Environment Setup

+INFO

R Environment Setup

+INFO

R Environment Setup

+INFO

R Environment Setup

+INFO

RStudio

+INFO

RStudio

+INFO

RStudio

04

The R Environment

ENVIRONMENT.R

The well-developed, simple and effective programming language, featuring user-defined recursive functions, loops, conditionals, and input and output facilities

05

Graphical facilities for data analysis and display that work on either for on-screen or hardcopy

04

A vast, easily understandable, integrated assortment of intermediate tools dedicated to data analysis

03

A suite of operators for array calculations, mainly matrices

02

The R environment consists of an integrated suite of software facilities designed for data manipulation, calculation and graphical display. The environment features:

R Environment

A high-performance data storage and handling facility

01

05

The R Packages

PACKAGES.R

Users connected to the Internet can use the install.packages() and update.packages() functions

To load a particular package (e.g., the boot package containing functions from Davison & Hinkley (1997)), use a command like: library(boot)

To get library locations containing R packages: .libPaths()

All R functions and datasets are stored in packages. Only when a package is loaded are its contents available.

R Packages

To see which packages are installed at your site, issue the command:library()

There are thousands of contributed packages for R, written by many different authors. Some of these packages implement specialized statistical methods, others give access to data or hardware, and others are designed to complement textbooks.

The standard (or base) packages are considered part of the R source code. They contain the basic functions that allow R to work, and the datasets and standard statistical and graphical functions that are described in this manual. They should be automatically available in any R installation.

02

Contributed Packages

01

Standard Packages / Base

R Packages-two general categories:

R Packages

06

R Variables

VARIABLES.R

+INFO

A valid variable name consists of letters, numbers and the dot or underline characters. The variable name starts with a letter or the dot not followed by a number.

R Variable Naming

07

Basic R Data Types

BASIC_DATA_TYPES.R

+INFO

We can use the class() function to check the data type of a variable

Basic data types in R can be divided into the following types:

R Basic Data Types

08

R Operators

OPERATORS.R

Miscellaneous operators

05

Logical operators

04

Relational/Comparison operators

03

Assignment operators

02

R divides the operators in the following groups:

R Operators

Arithmetic operators

01

+INFO

The table below lists the arithmetic operators supported by R. The operators act on each element of the vector.

R Arithmetic Operators

R Operators

+INFO

These operators are used to assign values to vectors.

R Assignment Operators

R Operators

+INFO

Comparison operators are used to compare two values. Each element of the first vector is compared with the corresponding element of the second vector. The result of comparison is a Boolean value.

R Comparison/Relational Operators

R Operators

+INFO

R Logical Operators

R Operators

+INFO

These operators are utilized for specialized tasks rather than general mathematical or logical calculation.

R Miscellaneous Operators

R Operators

09

R Math

MATH.R

The ceiling() function rounds a number upwards to its nearest integer, and the floor() function rounds a number downwards to its nearest integer, and returns the result: ceiling(1.5) floor(1.4)

The abs() function returns the absolute (positive) value of a number: abs(-4.7)

The sqrt() function returns the square root of a number: sqrt(16)

R also has many built-in math functions that allows you to perform mathematical tasks on numbers.

R Math

For example, the min() and max() functions can be used to find the lowest or highest number in a set: max(5, 10, 15) min(5, 10, 15)

10

R Data Structure

DATA_STRUCTURE.R

To create a data frame we use the data.frame() function.

Data Frame in R

Characteristics:

  • The columns name should be non-empty.
  • The rows name should be unique.
  • The data which is stored in a data frame can be a factor, numeric, or character type.
  • Each column contains the same number of data items.

A data frame can contain different data types such as numeric, character, factor, etc.

A data frame is a table or a two-dimensional array-like structure in which each column contains values of one variable and each row contains one set of values from each column.

R Data Structure

A data frame is used to store data table and the vectors which are present in the form of a list in a data frame, are of equal length.

To create a factor, use the factor() function and add a vector as argument

Factors

Factors are used to categorize data.

R Data Structure

Examples of factors are:

  • Demography: Male/Female
  • Music: Rock, Pop, Classic, Jazz
  • Training: Strength, Stamina

Add List Items

  • To add an item to the end of the list, use the append() function:
  • Ex: append(thislist, "orange")

Check if Item Exists

  • To find out if a specified item is present in a list, use the %in% operator.
  • Ex: "apple" %in% thislist

Change Item Value

  • To change the value of a specific item, refer to the index number.
  • Ex: thislist[1] <- "blackcurrant"

To create a list, use the list() function.

Lists

  • A list is a collection of data which is ordered and changeable.

R Data Structure

Access Lists

  • You can access the list items by referring to its index number, inside brackets. The first item has index 1, the second item has index 2, and so on.
  • Ex: thislist[1]

THANK YOU!

Next page

genially options