R Functions S&DS Exam One

  1. Q: What does abline() do?
    A: Adds a straight line to a plot.

  2. Q: What does abs() do?
    A: Returns the absolute value of a number.

  3. Q: What does apply() do?
    A: Applies a function to rows or columns of a matrix or array.

  4. Q: What does as.character() do?
    A: Converts an object to a character (text) type.

  5. Q: What does as.numeric() do?
    A: Converts an object to a numeric type.

  6. Q: What does as.vector() do?
    A: Converts an object to a vector.

  7. Q: What does attach() do?
    A: Attaches a dataset to the search path, making its columns accessible by name.

  8. Q: What does barplot() do?
    A: Creates a bar chart.

  9. Q: What does boot() do?
    A: Performs bootstrapping (resampling) for statistical analysis.

  10. Q: What does boot.ci() do?
    A: Calculates confidence intervals for bootstrapped results.

  11. Q: What does boxplot() do?
    A: Creates a boxplot to visualize data distribution.

  12. Q: What does by() do?
    A: Applies a function to subsets of data based on a factor.

  13. Q: What does c() do?
    A: Combines values into a vector or list.

  14. Q: What does calcTemp() do?
    A: (Custom function) Likely calculates temperature-related values.

  15. Q: What does cbind() do?
    A: Combines columns into a matrix or data frame.

  16. Q: What does cex() do?
    A: Controls the size of text and symbols in plots.

  17. Q: What does class() do?
    A: Returns the class (type) of an object.

  18. Q: What does cleanNHData() do?
    A: (Custom function) Likely cleans or preprocesses NH (New Hampshire) data.

  19. Q: What does colnames() do?
    A: Gets or sets the column names of a matrix or data frame.

  20. Q: What does colors() do?
    A: Lists available color names in R.

  21. Q: What does colSums() do?
    A: Calculates the sum of each column in a matrix or data frame.

  22. Q: What does complete.cases() do?
    A: Identifies rows with no missing values.

  23. Q: What does convertTimes() do?
    A: (Custom function) Likely converts time formats.

  24. Q: What does data.frame() do?
    A: Creates a data frame (a table-like structure).

  25. Q: What does dbinom() do?
    A: Calculates the probability density for a binomial distribution.

  26. Q: What does demo() do?
    A: Runs demonstration scripts in R.

  27. Q: What does dexp() do?
    A: Calculates the probability density for an exponential distribution.

  28. Q: What does dim() do?
    A: Returns the dimensions (rows and columns) of a matrix or data frame.

  29. Q: What does dirname() do?
    A: Extracts the directory name from a file path.

  30. Q: What does dnorm() do?
    A: Calculates the probability density for a normal distribution.

  31. Q: What does droplevels() do?
    A: Removes unused levels from a factor.

  32. Q: What does duplicated() do?
    A: Identifies duplicate rows or elements.

  33. Q: What does exp() do?
    A: Calculates the exponential value of a number.

  34. Q: What does factor() do?
    A: Converts a vector into a factor (categorical variable).

  35. Q: What does for() do?
    A: Creates a loop to repeat a task multiple times.

  36. Q: What does function() do?
    A: Defines a custom function in R.

  37. Q: What does getwd() do?
    A: Returns the current working directory.

  38. Q: What does glm() do?
    A: Fits a generalized linear model.

  39. Q: What does gsub() do?
    A: Replaces text patterns in a string.

  40. Q: What does head() do?
    A: Displays the first few rows of a dataset.

  41. Q: What does help() do?
    A: Opens documentation for a function.

  42. Q: What does hist() do?
    A: Creates a histogram to show data distribution.

  43. Q: What does hms() do?
    A: (Custom function) Likely handles time in hours, minutes, and seconds.

  44. Q: What does install.packages() do?
    A: Installs R packages from CRAN.

  45. Q: What does intersect() do?
    A: Finds common elements between two vectors.

  46. Q: What does is.na() do?
    A: Checks for missing values (NA) in data.

  47. Q: What does las() do?
    A: Controls the orientation of axis labels in plots.

  48. Q: What does legend() do?
    A: Adds a legend to a plot.

  49. Q: What does length() do?
    A: Returns the number of elements in a vector or list.

  50. Q: What does levels() do?
    A: Gets or sets the levels of a factor.

  51. Q: What does library() do?
    A: Loads an R package.

  52. Q: What does lines() do?
    A: Adds lines to a plot.

  53. Q: What does list() do?
    A: Creates a list (a collection of objects).

  54. Q: What does lm() do?
    A: Fits a linear regression model.

  55. Q: What does ln() do?
    A: (Custom function) Likely calculates the natural logarithm.

  56. Q: What does log() do?
    A: Calculates the natural logarithm.

  57. Q: What does log10() do?
    A: Calculates the base-10 logarithm.

  58. Q: What does ls() do?
    A: Lists all objects in the current environment.

  59. Q: What does matrix() do?
    A: Creates a matrix.

  60. Q: What does mean() do?
    A: Calculates the average of a set of numbers.

  61. Q: What does median() do?
    A: Calculates the middle value of a set of numbers.

  62. Q: What does merge() do?
    A: Combines two datasets into one.

  63. Q: What does mosaicplot() do?
    A: Creates a mosaic plot for categorical data.

  64. Q: What does ms() do?
    A: (Custom function) Likely handles time in milliseconds.

  65. Q: What does mtext() do?
    A: Adds text to the margins of a plot.

  66. Q: What does n() do?
    A: (Custom function) Likely counts the number of rows or elements.

  67. Q: What does N() do?
    A: (Custom function) Likely counts the number of rows or elements.

  68. Q: What does na.omit() do?
    A: Removes rows with missing values.

  69. Q: What does names() do?
    A: Gets or sets the names of an object.

  70. Q: What does nchar() do?
    A: Returns the number of characters in a string.

  71. Q: What does options() do?
    A: Sets or retrieves global R options.

  72. Q: What does par() do?
    A: Sets graphical parameters for plots.

  73. Q: What does paste() do?
    A: Combines strings with a separator.

  74. Q: What does paste0() do?
    A: Combines strings without a separator.

  75. Q: What does plot() do?
    A: Creates a basic graph or scatter plot.

  76. Q: What does points() do?
    A: Adds points to a plot.

  77. Q: What does Points() do?
    A: (Custom function) Likely adds points to a plot.

  78. Q: What does print() do?
    A: Displays an object in the console.

  79. Q: What does punctuation() do?
    A: (Custom function) Likely handles punctuation in text.

  80. Q: What does qq_plot() do?
    A: (Custom function) Likely creates a Q-Q plot.

  81. Q: What does qqline() do?
    A: Adds a reference line to a Q-Q plot.

  82. Q: What does qqnorm() do?
    A: Creates a Q-Q plot for normality testing.

  83. Q: What does qqPlot() do?
    A: Creates a Q-Q plot with additional features.

  84. Q: What does quantile() do?
    A: Calculates quantiles of a dataset.

  85. Q: What does range() do?
    A: Returns the minimum and maximum values of a dataset.

  86. Q: What does rbinom() do?
    A: Generates random numbers from a binomial distribution.

  87. Q: What does read.csv() do?
    A: Reads data from a CSV file into R.

  88. Q: What does read.data() do?
    A: (Custom function) Likely reads data from a file.

  89. Q: What does rep() do?
    A: Repeats a value or vector multiple times.

  90. Q: What does return() do?
    A: Specifies the output of a function.

  91. Q: What does rexp() do?
    A: Generates random numbers from an exponential distribution.

  92. Q: What does rm() do?
    A: Removes objects from the environment.

  93. Q: What does rnorm() do?
    A: Generates random numbers from a normal distribution.

  94. Q: What does round() do?
    A: Rounds numbers to a specified number of decimal places.

  95. Q: What does rownames() do?
    A: Gets or sets the row names of a matrix or data frame.

  96. Q: What does runif() do?
    A: Generates random numbers from a uniform distribution.

  97. Q: What does sample() do?
    A: Randomly samples elements from a vector.

  98. Q: What does sd() do?
    A: Calculates the standard deviation of a dataset.

  99. Q: What does seq() do?
    A: Generates a sequence of numbers.

  100. Q: What does set.seed() do?
    A: Sets the random number generator seed for reproducibility.

  101. Q: What does setwd() do?
    A: Sets the working directory.

  102. Q: What does sort() do?
    A: Sorts a vector in ascending or descending order.

  103. Q: What does sqrt() do?
    A: Calculates the square root of a number.

  104. Q: What does str() do?
    A: Displays the structure of an object.

  105. Q: What does subset() do?
    A: Filters data based on conditions.

  106. Q: What does substr() do?
    A: Extracts a substring from a string.

  107. Q: What does sum() do?
    A: Calculates the sum of a set of numbers.

  108. Q: What does summary() do?
    A: Provides a summary of statistical measures for a dataset.

  109. Q: What does t() do?
    A: Transposes a matrix or data frame.

  110. Q: What does t.test() do?
    A: Performs a t-test to compare two groups.

  111. Q: What does table() do?
    A: Creates a frequency table for categorical data.

  112. Q: What does tail() do?
    A: Displays the last few rows of a dataset.

  113. Q: What does text() do?
    A: Adds text to a plot.

  114. Q: What does tolower() do?
    A: Converts text to lowercase.

  115. Q: What does toTitleCase() do?
    A: Converts text to title case.

  116. Q: What does trimws() do?
    A: Removes extra spaces from text.

  117. Q: What does unique() do?
    A: Returns unique values from a vector.

  118. Q: What does var() do?
    A: Calculates the variance of a dataset.

  119. Q: What does which() do?
    A: Returns the indices of elements that meet a condition.

  120. Q: What does write.csv() do?
    A: Writes data to a CSV file.