1. Home
  2. Explore
  3. Computer Science
  4. Introduction to R

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to R

  • 134Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: R Foundations
The programming language introduced in the course as arguably the language of data science is
.

134 questions

  1. 1
    The programming language introduced in the course as arguably the language of data science is
    _____
    .
    Hint

    It is a free, open-source language commonly used for statistical computing.

    Answer

    R

  2. 2
    Compared with commercial software packages, R is especially accessible because it is
    _____
    and open source.
    Hint

    There is no purchase price for the core software.

    Answer

    free

  3. 3
    R is optimized for
    _____
    operations, allowing users to work with entire rows or tables without explicitly writing loops.
    Hint

    Think of operations applied to collections of values at once.

    Answer

    vector

  4. 4
    The large, supportive group that contributes examples, help, and new developments to R is the R
    _____
    .
    Hint

    It includes users and developers who support one another.

    Answer

    community

  5. 5
    R's third-party extensions are distributed as bundles of code called
    _____
    .
    Hint

    They add functions and capabilities to the base software.

    Answer

    packages

  6. 6
    The official R website for statistical computing is located at
    _____
    .
    Hint

    It is the home page for the R project.

    Answer

    r-project.org

  7. 7
    The comprehensive archive used to download R and many R packages is abbreviated
    _____
    .
    Hint

    The abbreviation refers to the Comprehensive R Archive Network.

    Answer

    CRAN

  8. 8
    When downloading R, the cloud mirror is convenient because it automatically directs users to the best available
    _____
    .
    Hint

    It is a geographically distributed download location.

    Answer

    mirror

  9. 9
    An R source or script file normally uses the file extension
    _____
    .
    Hint

    It consists of the letter associated with the language and a file-extension marker.

    Answer

    .R

  10. 10
    In the native R application, the window where code is written is called the source or
    _____
    window.
    Hint

    It contains the commands that make up a program.

    Answer

    script

  11. 11
    The R window that displays the results of commands is the
    _____
    window.
    Hint

    It shows text output from executed code.

    Answer

    console

  12. 12
    In an R script, a line beginning with a pound sign or hashtag is a
    _____
    line and is not executed as code.
    Hint

    It provides notes or explanations for the programmer.

    Answer

    commented

  13. 13
    In RStudio, the pane that stores variables currently available for use is the
    _____
    pane.
    Hint

    It represents the current collection of objects and variables.

    Answer

    environment

  14. 14
    RStudio provides a more
    _____
    interface by organizing the script, console, environment, and plots in one window.
    Hint

    The opposite would be having many separate windows.

    Answer

    unified

  15. 15
    RStudio standardizes keyboard commands across Mac, Windows, and Linux by providing consistent
    _____
    .
    Hint

    These are keyboard instructions used to perform operations.

    Answer

    commands

  16. 16
    A package that makes working with R more organized and easier is called
    _____
    .
    Hint

    It is an application that sits on top of R.

    Answer

    RStudio

  17. 17
    Base packages are installed with R but are not necessarily
    _____
    by default.
    Hint

    Installation makes a package available on the computer; this action makes it available in the current session.

    Answer

    loaded

  18. 18
    Contributed or third-party packages must generally be downloaded, installed, and then
    _____
    separately.
    Hint

    This makes the package's functions accessible to the current R session.

    Answer

    loaded

  19. 19
    The package manager used in the course to install and load other packages is
    _____
    .
    Hint

    Its name refers to managing packages.

    Answer

    Pacman

  20. 20
    Installing a package makes it available on the hard drive, whereas
    _____
    makes it accessible to current routines.
    Hint

    This action occurs within the current R session.

    Answer

    loading

  21. 21
    The function library loads a package without displaying a confirmation message, whereas require gives a
    _____
    message.
    Hint

    It tells the user that the package has been successfully loaded.

    Answer

    confirmation

  22. 22
    The package used for manipulating data frames is
    _____
    .
    Hint

    Its name begins with a shortened form of data.

    Answer

    dplyr

  23. 23
    The package used for cleaning up information is
    _____
    .
    Hint

    Its name relates to making data tidy.

    Answer

    tidyr

  24. 24
    The package used for working with strings or text information is
    _____
    .
    Hint

    Its name resembles the word string.

    Answer

    stringr

  25. 25
    The package used for manipulating date information is
    _____
    .
    Hint

    Its name is associated with dates and time.

    Answer

    lubridate

  26. 26
    The package used for importing and exporting data is
    _____
    .
    Hint

    Its name is described as R input and output.

    Answer

    rio

  27. 27
    The package that creates interactive applications that can be installed on websites is
    _____
    .
    Hint

    It is commonly used to build interactive web applications in R.

    Answer

    Shiny

  28. 28
    The package used to create interactive notebooks or rich documents is
    _____
    .
    Hint

    It combines R code, results, and formatted explanatory text.

    Answer

    R Markdown

  29. 29
    The default R command for basic graphical exploration is
    _____
    .
    Hint

    It adapts its output to the data types and number of variables supplied.

    Answer

    plot

  30. 30
    When a categorical variable such as species is supplied alone to plot, R produces a simple
    _____
    chart.
    Hint

    The chart displays counts for categories.

    Answer

    bar

  31. 31
    When a quantitative variable is supplied alone to the default plot command, R generally produces a
    _____
    plot.
    Hint

    The horizontal axis represents observation or row index in this case.

    Answer

    scatter

  32. 32
    When a categorical variable and a quantitative variable are supplied to plot, R commonly chooses a
    _____
    plot.
    Hint

    This graphic compares distributions across categories.

    Answer

    box

  33. 33
    When two quantitative variables are supplied to plot, R chooses a proper
    _____
    plot.
    Hint

    Each point represents the joint position of two measurements.

    Answer

    scatter

  34. 34
    A plot of an entire data frame containing several quantitative variables produces a matrix of
    _____
    plots.
    Hint

    The matrix shows pairwise relationships among variables.

    Answer

    scatter

  35. 35
    In a plot command, the argument pch = 19 selects a solid
    _____
    symbol.
    Hint

    It specifies the point character used for observations.

    Answer

    circle

  36. 36
    In a plot command, col specifies the
    _____
    of plotted elements.
    Hint

    It can be assigned a color name or a hexadecimal code.

    Answer

    color

  37. 37
    The argument lwd controls the
    _____
    of a plotted line.
    Hint

    Increasing it makes a line visually thicker.

    Answer

    linewidth

  38. 38
    The basic graphic most appropriate for a categorical variable is a
    _____
    chart.
    Hint

    It summarizes category frequencies with rectangular bars.

    Answer

    bar

  39. 39
    Before making a bar chart from raw categorical observations, the data should first be converted into a summary
    _____
    .
    Hint

    It contains the count for each category.

    Answer

    table

  40. 40
    The most basic graphic for a quantitative, scaled, interval, or ratio variable is a
    _____
    .
    Hint

    It groups numerical values into bins.

    Answer

    histogram

  41. 41
    When examining a histogram, analysts should inspect its shape, gaps, outliers, and
    _____
    .
    Hint

    This concerns whether high and low scores are balanced around the center.

    Answer

    symmetry

  42. 42
    In a histogram, the vertical axis usually displays the frequency or
    _____
    of observations in each bin.
    Hint

    It tells how many observations fall into a group.

    Answer

    count

  43. 43
    The breaks argument in a histogram suggests the number of
    _____
    .
    Hint

    These are the intervals into which observations are grouped.

    Answer

    bars

  44. 44
    A histogram can display proportions instead of frequencies by setting its output to
    _____
    .
    Hint

    This expresses values relative to the total distribution.

    Answer

    density

  45. 45
    A plot made from multiple versions of the same chart on the same scale is called small
    _____
    .
    Hint

    The term refers to repeated panels used for comparison.

    Answer

    multiples

  46. 46
    A scatterplot is primarily used to visualize the association between two
    _____
    variables.
    Hint

    Both variables are measured numerically.

    Answer

    quantitative

  47. 47
    If the spread of points changes substantially across the x-axis, the scatterplot shows
    _____
    .
    Hint

    The term describes unequal variance or a fanning pattern.

    Answer

    heteroscedasticity

  48. 48
    Overlaying plots increases information
    _____
    by placing complementary views in the same space.
    Hint

    It means more information is shown in a given amount of space.

    Answer

    density

  49. 49
    When overlaying plots, the recommended rule is to use views that complement rather than
    _____
    with one another.
    Hint

    The graphics should remain coherent and readable.

    Answer

    compete

  50. 50
    The command that adds a normal density curve to an existing plot is
    _____
    .
    Hint

    It draws a mathematical function over the current graph.

    Answer

    curve

  51. 51
    A kernel density estimator is nonparametric because it follows the
    _____
    of the observed data.
    Hint

    It can contain more curves than a fixed bell-shaped model.

    Answer

    distribution

  52. 52
    A rug plot marks each individual observation with a small vertical
    _____
    beneath the graph.
    Hint

    It provides a one-dimensional display of every data point.

    Answer

    line

  53. 53
    The R function that gives counts for categories and numerical summaries for quantitative variables is
    _____
    .
    Hint

    It provides a quick descriptive overview.

    Answer

    summary

  54. 54
    For a categorical variable, summary reports the frequency or
    _____
    of each category.
    Hint

    In the iris species example, each category has 50 observations.

    Answer

    count

  55. 55
    For a quantitative variable, summary reports the minimum, first quartile,
    _____
    , mean, third quartile, and maximum.
    Hint

    It is the middle value in an ordered distribution.

    Answer

    median

  56. 56
    Comparing the median and mean can provide clues about distributional
    _____
    .
    Hint

    A difference between these measures may indicate asymmetry.

    Answer

    skewness

  57. 57
    The summary function can be applied to an entire data
    _____
    at once.
    Hint

    This is R's spreadsheet-like two-dimensional structure.

    Answer

    frame

  58. 58
    The more detailed descriptive function used in the course comes from the contributed package
    _____
    .
    Hint

    It is commonly used for psychological and descriptive statistics.

    Answer

    psych

  59. 59
    Unlike summary, describe is intended primarily for
    _____
    variables rather than categories.
    Hint

    It reports statistics such as standard deviation, skewness, and kurtosis.

    Answer

    quantitative

  60. 60
    Among other statistics, describe reports sample size, mean, standard deviation, median, skewness, kurtosis, and standard
    _____
    .
    Hint

    These quantify uncertainty around estimates.

    Answer

    errors

  61. 61
    The recommended order for exploratory analysis is graphical summaries first and numerical summaries
    _____
    .
    Hint

    Pictures are used before precise numerical descriptions.

    Answer

    later

  62. 62
    Selecting cases allows an analyst to focus an analysis on particular
    _____
    .
    Hint

    These are individual observations or rows of data.

    Answer

    cases

  63. 63
    Cases can be selected by category, by value on a scaled variable, or by
    _____
    methods simultaneously.
    Hint

    The third option combines categorical and numerical conditions.

    Answer

    both

  64. 64
    In R, two equal signs, written as ==, test whether values are
    _____
    .
    Hint

    This is a comparison operator, not an assignment operator.

    Answer

    equivalent

  65. 65
    The ampersand operator combines multiple selection conditions by requiring that they are both
    _____
    .
    Hint

    It represents a logical AND relationship.

    Answer

    true

  66. 66
    The R data structure consisting of one or more values in one dimension is a
    _____
    .
    Hint

    Imagine the values arranged in a straight line.

    Answer

    vector

  67. 67
    All elements in an R vector must have the same
    _____
    .
    Hint

    A vector cannot mix arbitrary numeric, character, and logical elements without conversion.

    Answer

    data type

  68. 68
    A one-element vector is still considered a vector in R rather than a
    _____
    .
    Hint

    Some other programming contexts use this term for one number.

    Answer

    scalar

  69. 69
    A matrix is a two-dimensional structure organized into rows and
    _____
    .
    Hint

    It has a rectangular layout.

    Answer

    columns

  70. 70
    All values in an R matrix must have the same
    _____
    .
    Hint

    Matrices cannot normally contain arbitrary mixtures of data types.

    Answer

    class

  71. 71
    An array is like a matrix but has
    _____
    or more dimensions.
    Hint

    A matrix has two dimensions; an array extends beyond that.

    Answer

    three

  72. 72
    A data frame is a two-dimensional structure whose columns may contain different types but must have the same
    _____
    .
    Hint

    Each column must contain the same number of observations.

    Answer

    length

  73. 73
    The R structure most analogous to a spreadsheet is a data
    _____
    .
    Hint

    It has rows and columns with potentially different column types.

    Answer

    frame

  74. 74
    The most flexible R data structure is the
    _____
    .
    Hint

    It can contain elements of different classes, lengths, and structures.

    Answer

    list

  75. 75
    The process of changing a data object from one type or structure to another is called
    _____
    .
    Hint

    It can change a character to logical or a matrix to a data frame.

    Answer

    coercion

  76. 76
    When incompatible values are combined automatically, R generally coerces them to the least restrictive or most
    _____
    type.
    Hint

    Character data can encompass numeric and logical values after conversion.

    Answer

    general

  77. 77
    R uses
    _____
    precision as the default representation for numeric values.
    Hint

    It is also called double precision.

    Answer

    double

  78. 78
    The function as.integer converts a value to the
    _____
    data type.
    Hint

    This type represents whole-number values.

    Answer

    integer

  79. 79
    The function as.numeric converts character representations such as "1" and "2" into
    _____
    values.
    Hint

    The quotation marks are removed after successful conversion.

    Answer

    numeric

  80. 80
    The less-than sign followed by a dash, <-, is R's
    _____
    operator.
    Hint

    It assigns a value to a variable.

    Answer

    assignment

  81. 81
    A factor is an attribute of a vector that specifies possible values and their
    _____
    .
    Hint

    Factors can encode category order as well as category names.

    Answer

    order

  82. 82
    A factor records its possible categories as
    _____
    .
    Hint

    The factor example had three of these corresponding to 1, 2, and 3.

    Answer

    levels

  83. 83
    The function used to convert an existing variable into a factor is
    _____
    .
    Hint

    It begins with the standard coercion prefix.

    Answer

    as.factor

  84. 84
    Factor labels must be supplied in the same
    _____
    as the numerical codes they represent.
    Hint

    Code 1 receives the first label, code 2 the second, and so on.

    Answer

    order

  85. 85
    Although a labeled factor may display words such as Mac OS or Windows, its underlying values may remain
    _____
    codes.
    Hint

    The structure output still shows values such as 1, 2, and 3.

    Answer

    numerical

  86. 86
    The function that creates a sequence from a starting value to an ending value is the
    _____
    operator.
    Hint

    It is placed between two numbers, as in 0 to 10.

    Answer

    colon

  87. 87
    The function used to generate more specifically controlled sequences is
    _____
    .
    Hint

    It is short for sequence.

    Answer

    seq

  88. 88
    The function used to combine or collect values into a vector is
    _____
    .
    Hint

    Its name is short for concatenate.

    Answer

    c

  89. 89
    The function that reads data values interactively from the console is
    _____
    .
    Hint

    It lets the user type values and finish by pressing Enter twice.

    Answer

    scan

  90. 90
    The function used to repeat values or groups of values is
    _____
    .
    Hint

    Its name is short for replicate.

    Answer

    rep

  91. 91
    CSV stands for comma-separated
    _____
    .
    Hint

    It is a plain-text representation of tabular data.

    Answer

    values

  92. 92
    The file extension commonly associated with Excel workbooks is
    _____
    .
    Hint

    It is the later Excel format mentioned in the lesson.

    Answer

    .xlsx

  93. 93
    JSON is an abbreviation for JavaScript Object
    _____
    .
    Hint

    It is a common format for web data.

    Answer

    Notation

  94. 94
    The package that combines many R import functions into one utility with consistent syntax is
    _____
    .
    Hint

    Its name refers to R input and output.

    Answer

    rio

  95. 95
    The rio function used to import files of different formats is
    _____
    .
    Hint

    The same command can read CSV, TXT, and XLSX files.

    Answer

    import

  96. 96
    The R function that opens a spreadsheet-like view of an object is
    _____
    .
    Hint

    It is written with a capital first letter.

    Answer

    View

  97. 97
    The built-in function for reading a tab-delimited text file is
    _____
    .
    Hint

    It may require a header and a tab separator to be specified.

    Answer

    read.table

  98. 98
    The built-in function for reading comma-separated data is
    _____
    .
    Hint

    The file format is encoded in the function name.

    Answer

    read.csv

  99. 99
    When possible, Excel data should be exported as tab-delimited or comma-separated text before importing into
    _____
    .
    Hint

    The recommendation is to avoid directly reading Excel files when possible.

    Answer

    R

  100. 100
    Hierarchical clustering searches for observations that are similar, or “like with
    _____
    .”
    Hint

    The phrase describes grouping similar cases together.

    Answer

    like

  101. 101
    The clustering distance measure used in the example is
    _____
    distance.
    Hint

    It measures straight-line distance in multidimensional space.

    Answer

    Euclidean

  102. 102
    Hierarchical clustering does not require the analyst to set the number of groups in
    _____
    .
    Hint

    The number of clusters can be examined after the hierarchy is constructed.

    Answer

    advance

  103. 103
    In divisive clustering, all observations begin in one group and are gradually
    _____
    apart.
    Hint

    This is the opposite direction from agglomerative clustering.

    Answer

    split

  104. 104
    In agglomerative clustering, observations begin separately and are selectively put
    _____
    .
    Hint

    The process builds larger groups from individual cases.

    Answer

    together

  105. 105
    The tree-like graph produced by hierarchical clustering is called a
    _____
    .
    Hint

    Its branches show when observations or clusters split or join.

    Answer

    dendrogram

  106. 106
    A clustering solution is valid only for the specific observations and
    _____
    supplied to the analysis.
    Hint

    Changing the measurements used can change the resulting groups.

    Answer

    variables

  107. 107
    Principal component analysis is also known as
    _____
    reduction.
    Hint

    It reduces the number of dimensions while retaining important information.

    Answer

    dimensionality

  108. 108
    PCA begins by finding a regression-like direction and measuring the
    _____
    distance from each point to it.
    Hint

    This is not the ordinary vertical regression residual.

    Answer

    perpendicular

  109. 109
    Centering data moves variables so their
    _____
    are zero.
    Hint

    Subtracting the average produces this result.

    Answer

    means

  110. 110
    Scaling data in PCA places variables on a common scale with unit
    _____
    .
    Hint

    This prevents variables with larger ranges from dominating the analysis.

    Answer

    variance

  111. 111
    The R function used in the example to compute principal components is
    _____
    .
    Hint

    Its name combines principal components with a compact function name.

    Answer

    prcomp

  112. 112
    A PCA summary produces the same number of components as there are original
    _____
    .
    Hint

    Each original dimension contributes to the transformed representation.

    Answer

    variables

  113. 113
    A scree plot helps evaluate how much of the original
    _____
    each principal component explains.
    Hint

    Large components account for more variation in the data.

    Answer

    variance

  114. 114
    A PCA rotation value can be interpreted approximately as the association or
    _____
    between an original variable and a component.
    Hint

    It describes how strongly a variable relates to a principal component.

    Answer

    correlation

  115. 115
    A biplot in the example displays the first
    _____
    principal components.
    Hint

    It is a two-dimensional representation.

    Answer

    two

  116. 116
    Regression uses multiple predictor variables to predict one particular
    _____
    variable.
    Hint

    It is the variable being explained or predicted.

    Answer

    outcome

  117. 117
    In the regression example, the variable being predicted is whether a judge is worthy of
    _____
    .
    Hint

    It concerns whether the judge should remain on the bench.

    Answer

    retention

  118. 118
    The R function lm is short for
    _____
    model.
    Hint

    It is the basic function used for linear regression.

    Answer

    linear

  119. 119
    In an R model formula, the tilde means “is predicted by” or “as a function of” the
    _____
    on its right.
    Hint

    These variables are used to explain the outcome.

    Answer

    predictors

  120. 120
    Entering all predictor variables into one regression equation at the same time is called
    _____
    entry.
    Hint

    All predictors enter together rather than in selected steps.

    Answer

    simultaneous

  121. 121
    The regression coefficient representing the predicted value when all predictors are zero is the
    _____
    .
    Hint

    It is the constant term in the regression equation.

    Answer

    intercept

  122. 122
    The probability cutoff highlighted for statistical significance in the regression output is
    _____
    .
    Hint

    It is commonly written as .05 in statistical output.

    Answer

    0.05

  123. 123
    The statistic describing how well the predictors collectively explain the outcome is multiple
    _____
    squared.
    Hint

    It is commonly written with a superscript 2.

    Answer

    R

  124. 124
    The table used to summarize variance components in regression is the
    _____
    table.
    Hint

    Its name stands for analysis of variance.

    Answer

    ANOVA

  125. 125
    A confidence interval gives a lower and upper range for a coefficient, commonly using a
    _____
    percent interval in the example.
    Hint

    The interval leaves 2.5 percent in each tail.

    Answer

    95

  126. 126
    The differences between observed and model-predicted values are called
    _____
    .
    Hint

    They represent prediction errors for individual cases.

    Answer

    residuals

  127. 127
    The regression method described as least absolute shrinkage and selection operator is abbreviated
    _____
    .
    Hint

    It is a regularized regression method.

    Answer

    lasso

  128. 128
    The regression method that stands for least angle regression is abbreviated
    _____
    .
    Hint

    Its name is also the name of the package used in the example.

    Answer

    Lars

  129. 129
    Python is presented as another popular language for data science that also functions as a general-purpose
    _____
    language.
    Hint

    It can be used beyond statistical and data-analysis tasks.

    Answer

    programming

  130. 130
    Understanding how to design high-quality data visualizations is presented as a separate issue from simply using R's visualization
    _____
    .
    Hint

    R provides many of these for creating graphics.

    Answer

    packages

  131. 131
    Machine learning focuses on processing large amounts of data and obtaining
    _____
    from one set of data that can be applied to others.
    Hint

    The result should generalize beyond the original data.

    Answer

    predictions

  132. 132
    The annual conference for R users is called useR! and the exclamation point is part of its official
    _____
    .
    Hint

    It is not merely punctuation added informally.

    Answer

    name

  133. 133
    Local groups for R users are commonly abbreviated
    _____
    .
    Hint

    The abbreviation stands for R user groups.

    Answer

    RUGs

  134. 134
    The unofficial day suggested for celebrating R is September
    _____
    .
    Hint

    It coincides with International Talk Like a Pirate Day.

    Answer

    19

1 of 134
Question 1 of 134

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent