1 / 37

R Programming For Beginners | R Language Tutorial | R Tutorial For Beginners | Edureka

This Edureka R Programming Tutorial For Beginners (R Tutorial Blog: https://goo.gl/mia382) will help you in understanding the fundamentals of R and will help you build a strong foundation in R. Below are the topics covered in this tutorial: <br><br>1. Variables <br>2. Data types <br>3. Operators <br>4. Conditional Statements <br>5. Loops <br>6. Strings <br>7. Functions

EdurekaIN
Télécharger la présentation

R Programming For Beginners | R Language Tutorial | R Tutorial For Beginners | Edureka

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ` EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING What is Hadoop? https://www.edureka.co/r-for-analytics

  2. Agenda ➢ Variables ➢ Data types ➢ Operators ` ➢ Conditional Statements ➢ Loops ➢ Strings ➢ Functions EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  3. R Installation ` EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  4. RStudio Installation ` EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  5. Conditional Statements Data types Strings ` Functions Operators Loops Variables EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  6. Variable Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. Memory ` X = 15 X = 15 Y <- “Hello” TRUE -> B Y = Hello B = TRUE EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  7. Data types Conditional Statements Strings ` Functions Operators Loops Variables EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  8. Data types A data type, in programming, is a classification that specifies which type of value a variable has and what type of mathematical, relational or logical operations can be applied to it without causing an error. Memory ` Integer X = 15 X = 15 Y <- “Hello” TRUE -> B Numeric Y = 3.142857 Boolean B = TRUE EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  9. Data types Data types ` EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  10. Vector  A Vector is a sequence of data elements of the same basic type  There are 5 Atomic vectors, also termed as five classes of vectors. Logical True or False ` Integer 15L, 30L, 1699L Numeric 5, 3.14285, 945678 Complex 4+3i, 8+7i Character ‘A’, “Hey”, ’True’ EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  11. Matrix  Matrix are the R objects in which the elements are arranged in a two-dimensional rectangular layout. matrix(data, nrow, ncol, byrow, dimnames) Syntax ` ❖ data is the input vector which becomes the data elements of the matrix. ❖ nrow is the number of rows to be created. ❖ ncol is the number of columns to be created. ❖ byrow is a logical clue. If TRUE then the input vector elements are arranged by row. ❖ dimname is the names assigned to the rows and columns. EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  12. Array  Arrays are the R data objects which can store data in more than two dimensions. Syntax array( data, dim, dimnames) ` array( c(0:15), dim=c( 4,4,2,2) ) EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  13. Lists  Lists are the R objects which contain elements of different types like − numbers, strings, vectors and another list inside it. list(data) Syntax ` vtr1 <- c(1:5) vtr2 <- c("hi", "Hello", "How are you") vtr3 <-c(TRUE,TRUE, FALSE, FALSE) myList <- list(vtr1,vtr2, vtr3) EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  14. Data Frame  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. data.frame(data) Syntax ` data.frame(mtcars) EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  15. Conditional Statements Data types Strings ` Functions Loops Variables Operators EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  16. Data Operators in R Operations Operators are the constructs which can manipulate the value of operands. Arithmetic Operators Relational Operators ` Operators Logical Operators Assignment EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  17. Arithmetic and Relational Operators Relational Arithmetic a + b Addition a – b Subtraction a == b Equal To ` a * b a != b Multiplication Not Equal To a / b a > b Greater Than Division a < b a %% b Less Than Modulus a >= b Greater Than Equal To a^b Exponent a <= b Less Than Equal To a%/%b Floor Division EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  18. Assignment Operator There are two types of Assignment operators: Left and Right Equals x=5 Left ` Assign x<- 15 Equals 20=x Right 25 -> x Assign EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  19. Logical Operator There are three types of logical operators: AND, NOT, OR It combines each element of vectors and gives a output TRUE if both the elements are TRUE. a & b ` It combines each element of the vectors and gives a output TRUE if one the elements is TRUE. a | b Takes each element of the vector and gives the opposite logical value. !a EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  20. Conditional Statements ` Data types Strings Functions Loops Operators Variables EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  21. Conditional Statements If Statement Start Syntax: If Condition ` TRUE FALSE If code End EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  22. Conditional Statements Else If Statement Start Syntax: FALSE If Else If Condition Condition ` FALSE TRUE TRUE If code Else If code End EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  23. Conditional Statements Else Statement Start Syntax: FALSE If Else If Condition Condition ` FALSE TRUE TRUE Else code If code Else If code End EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  24. Conditional Statements Start Switch case Statement switch Condition Syntax: Case value1 Statement 1 ` Case value2 Statement 2 Case value3 Statement 3 default Statement End EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  25. Conditional Statements Strings Data types ` Functions Operators Variables Loops EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  26. Loops in R A loop statement allows us to execute a statement or group of statements multiple times. Loops Loops ` while repeat for EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  27. Repeat Loop Repeats a statement or group of statements while a given condition is TRUE. It tests the condition after executing the loop body. repeat Syntax: START ` EXECUTE BLOCK repeat TRUE CHECK CONDITION EXIT LOOP FALSE EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  28. While Loop Repeats a statement or group of statements while a given condition is TRUE. It tests the condition before executing the loop body. while Loop Syntax: START ` FALSE CHECK CONDITION TRUE repeat EXIT LOOP EXECUTE BLOCK EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  29. For Loop Repeats a statement or group of for a fixed number of times. It tests the condition before executing the loop body. for Loop Syntax: START Initialization ` FALSE Check condition Exit loop TRUE repeat Execute Statements Iteration EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  30. Strings Conditional Statements Data types ` Functions Operators Variables Loops EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  31. String in R  Any value written within a pair of single quote or double quotes in R is treated as a string. Syntax: ` EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  32. String in R Sequence Operations: ➢ Concatenation: str1<- ‘Hi’ str2<- “How are you?” "Hi How are you? " paste(str1,str2) ➢ Character Count: ` str<-“Edureka” nchar(str) 7 ➢ Case Change toupper(str) tolower(str) EDUREKA edureka str<-“Edureka” ➢ Substring str<-“Edureka” substring(str, 3, 6) “urek” EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  33. Conditional Statements Strings Data types Operators Variables Loops Functions https://www.edureka.co/r-for-analytics EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING

  34. Functions In R A function is a block of organized, reusable code that is used to perform a single, related action. Functions Function Add Functions ` Return 8 Call 1 Call (3,5) Return 15 Call 2 Predefined Functions User Defined Functions Call (6,9) Call 3 Return 6 Call (1,5) EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

  35. Session In A Minute Data Operators Data Types Install R & RStudio ` Functions Conditional Statements Loops EDUREKA DATA ANALYTICS WITH R CERTIFICATION TRAINING https://www.edureka.co/r-for-analytics

More Related