R – PROGRAMMING
Q1. What is Object program?
• Everything in R is an object. Therefore, when we read a dataset, or assign a value, or
write a function, these things are called objects in R.
Q2. Define data frame.
• A data frame is a table-like structure in R where each column can contain different types
of data.
Q3. Write down the web address for downloading R.
• [Link]
Q4. What is ‘vector’ and ‘list’ in R–programming?
• Vector: A one-dimensional array with elements of the same data type.
• List: A collection of elements that can have different data types.
Q5. What is meant by case sensitivity in R?
• R is case-sensitive; variables like Name, name, and NAME are different.
Q6. How many operators are used in R?
• Five types: Arithmetic, Relational, Logical, Assignment, Miscellaneous.
Q7. What is R?
• R is an open-source programming language for statistical computing, data analysis, and
graphics.
Q8. What is R environment?
• The R environment consists of all objects, functions, and data currently in memory.
Q9. How to find the length of a vector in R?
• > x < -c (Values)
> Length (X)
>
Q10. Identify different parts of the R command: x <- c (1, 2, 3, 4, 5)
• x: object name
• <-: assignment operator
• C (1, 2, 3, 4, 5): function creating a vector
Q11. Mention any five Logical operators used in R.
• &, |, !, &&, ||
Q12. What is argument in R?
• An argument is a value passed to a function to modify its behavior, e.g., mean (x,
trim=0.1)
Q13. How to recall and correct the previous commands in R?
• Use the up and down arrow keys.
Q14. When R software is ready to work?
• When the R prompt > appears.
Q15. What is the R command prompt?
• The symbol > indicating R is ready for commands.
Q16. What is meant by R script file?
• An R script file is a text file containing R commands, saved as R
Q17. Define a vector in R programming.
• A vector is a one-dimensional array with elements of the same type, e.g., x <- c (10, 20,
30)
Q18. How all objects from R can be deleted?
• Use rm (list = ls ())
Q19. Write the output of the following R command: x <- array (1:20, dim = c (4, 5))
• Output:
[,1] [,2] [,3] [,4] [,5]
[1,] 1 5 9 13 17
[2,] 2 6 10 14 18
[3,] 3 7 11 15 19
[4,] 4 8 12 16 20