To determine the number of characters in a string, you can use the ________ function in R.

  • len()
  • length()
  • nchar()
  • strlen()
In R, the nchar() function is used to determine the number of characters in a string. For example, nchar("Hello") would return 5.

What function is commonly used to create a basic scatter plot in R?

  • scatterplot()
  • plot()
  • points()
  • scatter()
The plot() function is commonly used to create a basic scatter plot in R. It can be used to visualize the relationship between two numeric variables by plotting the data points as individual points on the graph.

In R, a variable that contains a sequence of data is called a ________.

  • DataFrame
  • List
  • Matrix
  • Vector
A vector in R is a sequence of data elements of the same basic type. Members in a vector are officially called components. However, R also has other data structures like lists, matrix, and dataframe which can hold multiple data types or more complex data.

What techniques can be used in R to visualize high-dimensional data?

  • Scatter plots with color or size encoding
  • Parallel coordinate plots
  • Dimensionality reduction techniques like PCA or t-SNE
  • All of the above
All of the mentioned techniques can be used in R to visualize high-dimensional data. Scatter plots can encode additional dimensions through color or size. Parallel coordinate plots can show relationships between multiple variables. Dimensionality reduction techniques like PCA or t-SNE can project high-dimensional data into lower dimensions for visualization.

Suppose you're asked to write a function in R that uses a global variable. How would you do it?

  • Define the global variable outside of the function and access it within the function
  • Define the global variable inside the function and mark it as global using the global() function
  • Define the global variable inside the function and use the global_var() keyword
  • None of the above
To write a function in R that uses a global variable, you would define the global variable outside of the function and access it within the function. Since global variables are accessible from anywhere in the program, the function can directly reference and modify the global variable as needed.

Suppose you're asked to optimize a piece of R code that operates on large lists. What are some strategies you could use to improve its performance?

  • Minimize unnecessary copying of large lists
  • Utilize parallel processing or vectorized operations
  • Preallocate memory for the resulting list
  • All of the above
Some strategies to improve the performance of R code operating on large lists include minimizing unnecessary copying of large lists to reduce memory usage and computational overhead, utilizing parallel processing or vectorized operations to leverage multiple cores and optimize computation, and preallocating memory for the resulting list to avoid dynamic resizing. These strategies can help optimize memory management and computation efficiency.

Suppose you're given a numeric vector in R and asked to calculate its mean. How would you do it?

  • Use the mean() function with the vector as an argument
  • Use the median() function with the vector as an argument
  • Use the sum() function with the vector as an argument
  • Use the mode() function with the vector as an argument
To calculate the mean of a numeric vector in R, you would use the mean() function with the vector as an argument. The mean() function returns the arithmetic average of the values in the vector.

Suppose you're working with a dataset in R and you want to check the data type of a certain variable. How would you do it?

  • Either of the above
  • None of the above
  • Use the class() function
  • Use the typeof() function
Both typeof() and class() functions in R can be used to check the data type of a variable. While typeof() returns the internal storage mode, class() returns the attributes of the object as how it should be treated in context of object-oriented programming.

In R, the _________ function is used to print the output.

  • echo()
  • output()
  • print()
  • show()
The 'print()' function is used in R to print the output to the console. This can be used to display the value of a variable, a message, or the output of a function.

Which data type in R is used to store true/false values?

  • Boolean
  • Character
  • Logical
  • Numeric
In R, true/false values are stored as logical data type. This data type only has two possible values: TRUE and FALSE.