The post is about R Language Questions that are commonly asked in interviews or R Language-related examinations and tests.
Table of Contents
R Language Questions
Question: What is a file in R?
Answer: A script file written in R has a file extension of R. Since, R is a programming language designed to perform statistical computing and graphics on given data, that is why, a file in R contains code that can be executed within the R software environment.
Question: What is the table in R?
Answer: A table in R language is an arbitrary R object, that is inherited from the class “table” for the as.data.frame
method. A table in R language refers to a data structure that is used to represent categorical data and frequency counts. A table provides a convenient way to summarize and organize the data into a tabular format, making it easier to analyze and interpret.
Factor Variables in R
Questions: What is the factor variable in R language?
Answer: Factor variables are categorical variables that hold either string or numeric values. The factor variables are used in various types of graphics, particularly for statistical modeling where the correct number of degrees of freedom is assigned to them.
Data Structure in R
Questions: What is Data Structure in R?
Answer: A data structure is a specialized format for organizing and storing data. General data structure types include the array, the file, the record, the table, the tree, and so on. R offers several data structures, each with its characteristics and purposes. In R common data structures are: vector, factor, matrix, array, data frame, and lists.
scan() Function in R
Question: What is a scan() in R?
Answer: The scan() in R is used to Read Data Values: Read data into a vector or list from the console or file. For Example:
Z <- scan() 1: 12 5 3: 2 4: Read 3 items > z [1] 12 5 2
readline() Function in R
Questions: What is readline() in R?
Answer: The deadline() function in R, read text lines from a Connection: Read some or all text lines from a connection. One can use readline() for inputting a line from the keyboard in the form of a string. For Example:
w <- readline() xyz vw u > w [1] "xyz vw u"