Skip to content

Instantly share code, notes, and snippets.

@rajanand
Created March 10, 2018 06:18
Show Gist options
  • Save rajanand/d51732f93fe75ef37283887d1b37c733 to your computer and use it in GitHub Desktop.
Save rajanand/d51732f93fe75ef37283887d1b37c733 to your computer and use it in GitHub Desktop.
Introduction to R programming
x <- 1.5
class(x)
#> [1] "numeric"
x <- 1
class(x)
#> [1] "numeric"
#Uppercase L should be suffixed with the number to assign integer datatype.
x <- 1L
class(x)
#> [1] "integer"
#Both TRUE and T means logical True. It should be in uppercase as R is a case sensitive.
x <- TRUE
class(x)
#> [1] "logical"
x <- T
class(x)
#> [1] "logical"
x <- 'some text'
class(x)
#> [1] "character"
x <- "Isn't it?"
class(x)
#> [1] "character"
x <- 'She said, "It is great"'
class(x)
#> [1] "character"
x <- 'She said, "It\'s great"'
class(x)
#> [1] "character"
x <- "She said, \"Wow\""
class(x)
#> [1] "character"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment