/    /  R programming – Interview questions Part 3

1. How many sorting algorithms are available?

Answer: There are 5 types of sorting algorithms are used which are:-

1. Bubble Sort

2. Selection Sort

3. Merge Sort

4. Quick Sort

5. Bucket Sort

 

2. Explain how to create new variable in R programming?

Answer: For creating new variable assignment operator ‘<-’ is used.

For Example:

mydata$sum <- mydata$x1 + mydata$x2

 

3. What are R packages?

Answer: Packages are the collections of data, R functions and compiled code in a well-defined format and these packages are stored in library. One of the Stability of R is the user-written function in R language.

 

4. What is the workspace in R?

Answer:  Workspace is the current R working environment which includes any user defined objects like vector, lists etc.

 

5. What is the function which is used for merging of data frames horizontally in R?

Answer:  Merge()function is used to merge two data frames.

Example:

Sum<-merge(data frame1,data frame 2,by=’ID’)

 

6. what is the function which is used for merging of data frames vertically in R?

Answer:  rbind() function is used to merge two data frames vertically.

Example:

Sum<- rbind(data frame1,data frame 2)

 

7. What is the power analysis?

Answer: It is used for experimental design .It is used to determine the effect of given sample size.

 

8. What package is used for power analysis in R?

Answer: In power analysis Pwr package is used in R.

 

9. Which method is used for exporting the data in R?

Answer:  There are many ways to export the data into another formats like SPSS, SAS , Stata , Excel Spreadsheet.

 

10. Which packages are used for exporting of data?

Answer:  For Exporting data in excel xlsReadWrite package is used and for sas,spss ,stata foreign package is implemented.