Home
71.
How Will You Check If An Element 25 Is Present In A Vector?

There are various ways to do this- It can be done using the match () function- match () function returns the first appearance of a particular element.
The other is to use %in% which returns a Boolean value either true or false.
Is.element () function also returns a Boolean value either true or false based on whether it is present in a vector or not.

72.
What Is The Difference Between Library() And Require() Functions In R Language?
A variable name in R programming language can contain numeric and alphabets along with special characters like dot (.) and underline (-). Variable names in R language can begin with an alphabet or the dot symbol. However, if the variable name begins with a dot symbol it should not be a followed by a numeric digit.
73.
What Will Be The Result Of Multiplying Two Vectors In R Having Different Lengths?

The multiplication of the two vectors will be performed and the output will be displayed with a warning message like – “Longer object length is not a multiple of shorter object length.” Suppose there is a vector a<-c (1, 2, 3) and vector b <- (2, 3) then the multiplication of the vectors a*b will give the resultant as 2 6 6 with the warning message. The multiplication is performed in a sequential manner but since the length is not same, the first element of the smaller vector b will be multiplied with the last element of the larger vector a.

74.
How Will You Convert A Factor Variable To Numeric In R Language ?

A factor variable can be converted to numeric using the as.numeric() function in R language. However, the variable first needs to be converted to character before being converted to numberic because the as.numeric() function in R does not return original values but returns the vector of the levels of the factor variable.
X <- factor(c(4, 5, 6, 6, 4))
X1 = as.numeric(as.character(X))

75.
What is the difference between supervised and unsupervised machine learning?

Supervised Machine learning:
Supervised machine learning requires training labeled data.
Unsupervised Machine learning:
Unsupervised machine learning doesn’t required labeled data.