WorksheetsR Language 3rd_year biotech Lab 1
Total questions: 23
Worksheet time: 15mins
What is the primary purpose of using the R language?
To write novels
To design websites
To give orders to a PC for data analysis
To create video games
Which of the following is NOT a data type in R?
integer
logical
string
character
What is a vector in R?
A collection of different data types
A function to manipulate data
A one-dimensional array of data
A two-dimensional table
How do you define a variable in R?
Using the keyword 'var'
By writing its name followed by '=' then the value
By using the 'define' command
By writing its name followed by '->' then the value
What does the dollar sign '$' signify in R?
It denotes a function
It indicates a comment
It specifies a column name in a data frame
It represents a variable
Which of the following is a correct way to create a data frame in R?
df -> data.frame(x, y, z)
df <- new.data.frame(x, y)
df <- create.data.frame(x, y)
df <- data.frame(x, y)
What is the data type of the output of this code:
df$IC50 < 400
(assume there is a dataframe called df containing IC50 column with numeric value)
A data frame
A character string
An integer
A logical vector
What does the 'subset()' function do in R?
It sorts data in ascending order
It merges two data frames
It filters data based on conditions
It creates a new empty data frame
Which of the following is a valid logical value in R?
TRUE
true
True
TRue
What is the minimum number of dimensions in matrix in R?
One-dimensional
Two-dimensional
Three-dimensional
In R, how do you represent a character string?
With curly braces
With square brackets
With single or double quotes
With parentheses
Which of the following is an example of a factor in R?
A logical value
A categorical variable
A character string
A numeric value
What does the command 'cat()' do in R?
It concatenates and prints objects
It defines a variable
It reads data from a file
It creates a plot
How do you extract rows from a data frame based on a condition?
Using the extract() function
Using the select() function
Using the subset() function
What is the output of 'df[df$IC50 < 200, ]'?
An error message
All columns with rows having IC50 less than 200
All rows with IC50 greater than 200
A summary of the data frame
Which of the following is a valid numeric value in R?
3.14
'3.14'
three point one four
3,14
What does the 'c()' function do in R?
It combines values into a vector
It creates a character string
It calculates the mean
It converts data types
Which of the following is NOT a data structure in R?
Array
Data frame
Matrix
Table
What does the 'length()' function return in R?
The number of rows in a data frame
The number of columns in a data frame
The number of elements in a vector
The size of a matrix
Which of the following is a valid way to comment in R?
<--
#
//
/* */
Which of the following is a valid way to create a numeric vector in R?
new.vector(1, 2, 3)
vector(1, 2, 3)
c(1, 2, 3)
list(1, 2, 3)
What is the output of 'df$IC50 < 200' if no rows meet the condition?
A summary of the data frame
An error message
A logical vector of FALSE
A data frame with zero rows
draw something to share with your friends

