R Programing Interview Questions

With just about any program out there, there are going to be advantages and disadvantages. Your interviewer is not necessarily looking for all of the pros and cons, nor is he or she necessarily expecting you to name specific features. Your interviewer is just using this as another question to test the extent of your knowledge, so be sure to know some pros and cons before heading into your interview. For example, you can say that many programmers like R because it’s free, widely accessible, and has built-in functionality via R packages. For disadvantages, you may want to point out that there are some security flaws, and that it is also open-source, which some people even consider a disadvantage. Keep it simple by thinking about what you personally like about R, and what you don’t.

**Subset()**

is used to select the variables and observations and **sample()**

function is used to generate a random sample of the size n from a dataset.
Dataframe can contain different type of data but matrix can contain only similar type of data. Here are the different types of data structures in R:

There are various applications available in real-time. These applications are as follows :

5 .

RStudio is an integrated development environment which allows us to interact with R more readily. RStudio is similar to the standard RGui, but it is considered more user-friendly. This IDE has various drop-down menus, windows with multiple tabs, and so many customization processes. The first time when we open RStudio, we will see three Windows. The fourth Window will be hidden by default.

This is the package which is loaded by default when R environment is set. It provides the basic functionalities like input/output, arithmetic calculations etc. in the R environment.

Logistic regression deals with measuring the probability of a binary response variable. In R the function

**glm()**

is used to create the logistic regression. General format is :

```
Mymatrix< - matrix (vector, nrow=r , ncol=c , byrow=FALSE,
dimnames = list ( char_vector_ rowname, char_vector_colnames))
```

Use the code

```
myTable = data.frame()
edit(myTable)
```

The applied family of functions is a built-in family which appears with the built-in packages in R. It is already installed in it.

It allows us to manipulate data frames, vectors, arrays, etc. It works more effectively than loops and also gives better performance from them which is faster at the execution level. It reduces the need for explicitly creating a loop in R.

`apply()`

function :**apply()**

`lapply()`

function :`lappy()`

`sapply()`

function :**lappy()**

however it works same as **lappy()**

. It also takes a list as an argument and applies a function to each element of the list by looping. The only difference is in output generalization. Where **lappy()**

returns a list as an output every time, sapply returns certain algorithms as output.`sapply()`

`tapply()`

function :`tapply()`

`mapply()`

function :`mapply()`