Home
66.
Differentiate Between Lapply And Sapply?

If the programmers want the output to be a data frame or a vector, then sapply function is used whereas if a programmer wants the output to be a list then lapply is used. There one more function known as vapply which is preferred over sapply as vapply allows the programmer to specific the output type. The disadvantage of using vapply is that it is difficult to be implemented and more verbose.

67.
Differentiate Between Seq (6) And Seq_along (6)?

Seq_along(6) will produce a vector with length 6 whereas seq(6) will produce a sequential vector from 1 to 6 c( (1,2,3,4,5,6)).

68.
What Do You Understand By Element Recycling In R?

If two vectors with different lengths perform an operation –the elements of the shorter vector will be re-used to complete the operation. This is referred to as element recycling.
Example – Vector A <-c(1,2,0,4) and Vector B<-(3,6) then the result of A*B will be ( 3,12,0,24). Here 3 and 6 of vector B are repeated when computing the result.

69.
What Is The Purpose Of Using Next Statement In R Language?

If a developer wants to skip the current iteration of a loop in the code without
terminating it then they can use the next statement. Whenever the R parser
comes across the next statement in the code, it skips evaluation of the loop
further and jumps to the next iteration of the loop.
 

 
70.
How Will You Create Scatter Plot Matrices In R Language?
A matrix of scatter plots can be produced using pairs. Pairs function takes various parameters like formula, data, subset, labels, etc.
The two key parameters required to build a scatter plot matrix are formula- A formula basically like ~a+b+c . Each term gives a separate variable in the pairs plots where the terms should be numerical vectors. It basically represents the series of variables used in pairs.
data- It basically represents the dataset from which the variables have to be taken for building a scatterplot.