R Language Interview Questions and Answers
Ques 1. What is R?
R is a programming language and free software environment for statistical computing and graphics.
Example:
print('Hello, R!')
Ques 2. How do you assign a value to a variable in R?
You can use the assignment operator <- or =.
Example:
x <- 10
Ques 3. Explain what a data frame is in R.
A data frame is a two-dimensional, heterogeneous tabular data structure with rows and columns.
Example:
df <- data.frame(Name=c('John', 'Jane'), Age=c(25, 30))
Ques 4. What is the use of the 'attach()' function in R?
The attach() function is used to attach a data frame to the search path, making it easier to refer to variables in the data frame.
Example:
attach(df)
Ques 5. How can you install a package in R?
You can use the install.packages() function.
Example:
install.packages('packageName')
Most helpful rated by users: