/    /  R programming – Interview questions Part 2

1. What are the advantages of R?

Answer: The advantages are:-

1. It is used for managing and manipulating of data.

2. No license restrictions

3. Free and open source software.

4. Graphical capabilities of R are good.

5. Runs on many Operating systems and also run on 32 & 64 bit processors etc.


2. Which is the function used for adding datasets in R?

Answer: For adding two datasets rbind() function is used but the column of two datasets must be same.

Syntax:  rbind(x1,x2……) where x1,x2: vector, matrix, data frames.


3. How you can produce co-relations and covariances?

Answer: Cor-relations is produced by cor() and covariances is produced by cov() function.


4. What is difference between matrix and dataframes?

Answer: Matrix can contain only similar type of data, whereas Dataframe can contain different type of data


5. What is difference between lapply and sapply?

Answer: lapply is used to show the output in the form of list whereas sapply is used to show the output in the form of vector or data frame


6. What is the difference between seq(4) and seq_along(4)?

Answer:  Seq(4) means vector from 1 to 4 (c(1,2,3,4)) whereas seq_along(4) means a vector of the  length(4) or 1(c(1)).


7. How can you start the R commander GUI. Explain?

Answer: rcmdr command is used to start the R commander GUI.


8. What is the memory limit of R?

Answer:  In 32 bit system memory limit is 3Gb but most versions limited to 2Gb and in 64 bit system memory limit is 8Tb.


9. How many data structures R has?

Answer: There are 5 data structure in R i.e. vector, matrix, array which are of homogenous type and other two are list and data frame which are heterogeneous.


10. Explain how data is aggregated in R.

Answer: There are two methods that is collapsing data by using one or more BY variable and other is aggregate() function in which BY variable should be in list.