Reading — step 1 of 5
Learn
~1 min readThe Vector Mindset
R uses <- for assignment by convention (also = works, but <- is the idiomatic R style).
x <- 5
name <- "Ada"
pi_value <- 3.14159
R has these basic types:
- numeric — double-precision floats (the default for numbers)
- integer — append
L:42L - character — strings, double or single quotes
- logical —
TRUE,FALSE(orT,F) - NA — missing value (one per type, e.g.
NA_integer_) - NULL — absence of value
class(x) tells you the type. typeof(x) is more granular.
x <- 5
class(x) # "numeric"
class(5L) # "integer"
class("hi") # "character"
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…