**71. Write a custom function in R**

Sometimes you’ll be asked to create a custom function on the fly. An example of a custom function below,

myFunction <- function(arg1, arg2, … ){

statements

return(object)

}

Functions can be simple or complex, but they should make your code more extensible, readable, and efficient. This is a chance to show your ingenuity and experience.

**72What is the use of sink(), Library () and search() function?**

These functions are used for the following purposes:

Sink(): It defines the output direction i.e. where the output will reach?

Library(): It can be used to show installed packages

Search(): This function can display the currently loaded packages

**73. Write the full form MANOVA and why is it used?**

Full form of MANOA is a multivariant analysis of variance. Through this function, we can test more than one dependent variable. We can check them simultaneously.

**74. Why are the VCD and lattice packages used?**

Through vcd package, we can visualize multivariate categorical data. Lattice package is used to improve R graphics and better defaults are given to the package. We can display the multivariate relationship.

**75. How can we create a table using R language without using external files?**

The following syntax can be used to create a table in R language:

NewTable=data.frame()

Edit(NewTable)

Through the above code a new Excel Spreadsheet so that you can enter the values in NewTable. In this way, a new table can be created.

**76. Enlist the addition function used in R language?**

To add two datasets there is two functions rbind() function, through which we can add the column values of two data sets.

The syntax is as follows: rbind(x1,x2,—-) where x1, x2: vector, matrix, data frames

**77. Which packages are used to store and restore R objects to and from a file in R language?**

To store an object in a file we can use Save command and the syntax for this is as:

Syntax: > save(z,file=”z.Rdata”)

While to restore R object we can use the following command:

Syntax:> load(“z.Rdata”)

**78. Why is R useful for data science?**

R turns otherwise hours of graphically intensive jobs into minutes and keystrokes. In reality, you probably wouldn’t encounter the language of R outside the realm of data science or an adjacent field. It’s great for linear modeling, nonlinear modeling, time-series analysis, plotting, clustering, and so much more.

Simply put, R is designed for data manipulation and visualization, so it’s natural that it would be used for data science.

### 79. What is a factor variable, and why would you use one?

A factor variable is a form of the categorical variable that accepts either numeric or character string values. The most salient reason to use a factor variable is that it can be used in statistical modeling with great accuracy. Another reason is that they are more memory efficient.

Simply use the factor() function to create a factor variable.

**80. Mention what does not ‘R’ language do?**

- Though R programming can easily connect to DBMS is not a database
- R does not consist of any graphical user interface
- Though it connects to Excel/Microsoft Office easily, R language does not provide any spreadsheet view of data