Jawaharlal Nehru Technological University Hyderabad
Jawaharlal Nehru Technological University Hyderabad B.Tech IV R PROGRAMMING Previous Question Paper (September 2020 - R16)
Answer any Five Questions
All Questions Carry Equal Marks
Main
R has five “atomic” classes of objects. What are they? Quote examples.
Answer
The five basic or atomic classes of objects in R are character, numeric (real numbers), integer, complex, and logical (TRUE/FALSE). These represent the fundamental data types used to store values.
- Character: Used for text data. Example:
x <- "Hello" - Numeric: Used for decimal or real numbers. Example:
x <- 10.5 - Integer: Used for whole numbers; denoted by an 'L' suffix. Example:
x <- 5L - Complex: Used for numbers with an imaginary component. Example:
x <- 1 + 2i - Logical: Used for boolean values. Example:
x <- TRUE
Make a comparison of implicit coercion and explicit coercion.
Answer
Coercion in R refers to the process of converting an object from one data type to another. This can happen automatically (implicit) or manually (explicit).
| Feature | Implicit Coercion | Explicit Coercion |
|---|---|---|
| Definition | Automatic conversion by R. | Manual conversion by the user. |
| Trigger | Occurs when combining different types in a vector. | Occurs using specific conversion functions. |
| Control | Controlled by R's internal rules. | Controlled by the programmer. |
| Example | c(1, "a") becomes a character vector. | as.numeric("5") converts string to number. |
Implicit coercion follows a hierarchy (e.g., logical to integer to numeric to character) to ensure data consistency within a structure. Explicit coercion is performed using functions such as as.numeric(), as.character(), as.logical(), and as.integer(), allowing the user to force a specific data type when the default behavior is not desired or when data needs to be pre-processed for specific mathematical operations.
Demonstrate repeat loop and seq_along ( ) function.
Answer
Sign in to view the complete answer paper.
Explain argument matching in R functions.
Answer
Sign in to view the complete answer paper.
How to create a list and demonstrate all the ways of accessing a list component.
Answer
Sign in to view the complete answer paper.
Demonstrate finding the largest cells in a table.
Answer
Sign in to view the complete answer paper.
What are the arguments in a call to table( )? Give example.
Answer
Sign in to view the complete answer paper.
What kind of tools does R has for simulation programming?
Answer
Sign in to view the complete answer paper.
Discuss the significance of visualization and R’s support for it.
Answer
Sign in to view the complete answer paper.
How are complex numbers handled in R? Explain with suitable examples.
Answer
Sign in to view the complete answer paper.
How to import packages in R? Give examples.
Answer
Sign in to view the complete answer paper.
Illustrate the concept of recycling in vectors.
Answer
Sign in to view the complete answer paper.
What effect does concatenate function has on vectors? Explain with an example.
Answer
Sign in to view the complete answer paper.
Which matrix operations are applicable to data frames? Explain with examples.
Answer
Sign in to view the complete answer paper.
How to run a logistic regression model on data in a data frame? Give illustration.
Answer
Sign in to view the complete answer paper.