WorksheetsProgramming R Quiz
Total questions: 10
Worksheet time: 5mins
What does the function `install.packages()` do in R?
It updates installed packages to the latest version.
It installs new R packages from CRAN.
It lists all available packages in CRAN.
It removes specified packages from the system.
Which function is used to read a CSV file in R?
read.csv()
read_excel()
open.csv()
file.open()
How do you create a vector in R containing the numbers 1 through 5?
c(1:5)
vector(1, 5)
list(1-5)
sequence(1, 5)
What symbol is used to assign a value to a variable in R?
=
:=
<-
==
Which of the following is a way to generate a sequence of numbers from 1 to 10 in steps of 2 in R?
seq(1, 10, by=2)
sequence(1, 10, 2)
1:10+2
c(1, 3, 5, 7, 9)
How do you check the structure of a data frame named `df` in R?
structure(df)
str(df)
typeof(df)
describe(df)
What is the output of the following code snippet? ```R x <- c(TRUE, FALSE, TRUE, FALSE) sum(x) ```
0
2
4
TRUE
Which function in R is used to apply a function over the margins of an array or matrix?
lapply()
apply()
sapply()
tapply()
What does the `ggplot2` package in R primarily used for?
Data manipulation
Statistical analysis
Data visualization
Machine learning
How do you install multiple packages at once in R?
install.packages(c("dplyr", "ggplot2"))
install.packages("dplyr", "ggplot2")
c(install.packages("dplyr"), install.packages("ggplot2"))
install.packages("dplyr") + install.packages("ggplot2")
