Skip to content

Instantly share code, notes, and snippets.

@prasoonsharma
Created November 26, 2010 03:43

Revisions

  1. prasoonsharma revised this gist Dec 2, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ age <- 25
    # Numeric
    hourly_wage <- 27.25

    # Factor
    # Factor: Categorical variables (take on a limited number of different values). Similar to lookups in Excel/databases
    office <- factor("NYO", levels = c("NYO", "MUM", "SYD"))

    # Boolean
  2. prasoonsharma revised this gist Nov 27, 2010. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -28,6 +28,8 @@ time.till.retirement <- 60 - age
    # Numeric
    weekly.compensation <- 40 * hourly_wage
    round(hourly_wage, 1)
    # absolute
    abs(-39 + 10)

    # Boolean
    has.kids <- TRUE
  3. prasoonsharma revised this gist Nov 27, 2010. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,7 @@ time.till.retirement <- 60 - age

    # Numeric
    weekly.compensation <- 40 * hourly_wage
    round(hourly_wage, 1)

    # Boolean
    has.kids <- TRUE
  4. prasoonsharma revised this gist Nov 26, 2010. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -30,4 +30,9 @@ weekly.compensation <- 40 * hourly_wage

    # Boolean
    has.kids <- TRUE
    # AND
    married && has.kids
    # OR
    married || has.kids
    # NOT
    ! married
  5. prasoonsharma revised this gist Nov 26, 2010. 1 changed file with 21 additions and 4 deletions.
    25 changes: 21 additions & 4 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,33 @@
    # ATOMIC DATA TYPES IN R

    # Character
    name <- "Kirk"
    first.name <- "Kirk"

    # Integer data type
    # Integer
    age <- 25

    # Numeric data type
    # Numeric
    hourly_wage <- 27.25

    # Factor
    office <- factor("NYO", levels = c("NYO", "MUM", "SYD"))

    # Boolean
    married <- TRUE
    married <- TRUE


    # OPERATIONS ON ATOMIC TYPES

    # Character
    last.name <- "Davis"
    full.name <- paste(first.name, last.name)

    # Integer
    time.till.retirement <- 60 - age

    # Numeric
    weekly.compensation <- 40 * hourly_wage

    # Boolean
    has.kids <- TRUE
    married && has.kids
  6. prasoonsharma revised this gist Nov 26, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Atomic data types in R
    # ATOMIC DATA TYPES IN R

    # Character
    name <- "Kirk"
  7. prasoonsharma created this gist Nov 26, 2010.
    16 changes: 16 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Atomic data types in R

    # Character
    name <- "Kirk"

    # Integer data type
    age <- 25

    # Numeric data type
    hourly_wage <- 27.25

    # Factor
    office <- factor("NYO", levels = c("NYO", "MUM", "SYD"))

    # Boolean
    married <- TRUE