β Must-know
π R treats numbers as double-precision numeric values by default, whereas the L suffix explicitly marks an integer, as in 42L.
Further detail
Character values are text enclosed in single or double quotes, while logical values are case-sensitive TRUE or FALSE values.
Complex values contain real and imaginary parts, with the imaginary part denoted by i, as in 3 + 4i.
In R, is.xxxx functions can check a data type and as.xxxx functions can transform a value's type.
π An R variable name starts with a letter or a dot not immediately followed by a number; later characters may be letters, numbers, dots, or underscores.
1. In R, what type is assigned to each value in `a <- 42` and `b <- 42L`, respectively?
2. Which set lists Rβs five primary data types?
3. A programmer wants an R variable name that starts with a dot and continues with a letter. Which candidate follows the naming rule?
What are R's primary data types?
Numeric, integer, character, logical, and complex.
How does R represent numbers by default, and what marks an integer explicitly?
Numbers default to double-precision numeric values; the L suffix marks an integer, as in 42L.
What may begin an R variable name?
A letter or a dot not immediately followed by a number.
Which characters may appear later in an R variable name?
Letters, numbers, dots, or underscores.
What characters are prohibited in R variable names?
Spaces and special characters.
Which kinds of words should not be used as R variable names?
Reserved words such as if, else, TRUE, FALSE, NULL, for, or function.
It covers the core concepts of R Variables Vectors and Random Numbers, organized by topic with the key definitions, explanations and takeaways, so it's easier to learn and remember.
Read the full study guide βThe practice quiz has 11 multiple-choice questions, each with an explanation. Use it to check what you know and find your gaps.
Take the quiz (11 questions) βThere are 38 flashcards on R Variables Vectors and Random Numbers, with a question on the front and the answer on the back. Try to recall each answer before you flip, and let spaced repetition bring back the ones you miss.
See all 38 flashcards βUpload a PDF or paste your notes. Revizly writes a study guide, a practice quiz and flashcards in about a minute.