Data Types and Variables in R
Data Types and Variables in R - Important Points
16. | Which of the following functions is used to convert a character variable to a numeric variable in R? |
---|
A. as.numeric()
B. as.character()
C. as.logical()
D. as.factor()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The as.numeric() function is used to convert a character variable to a numeric variable in R.
17. | Which of the following functions is used to convert a numeric variable to a character variable in R? |
---|
A. as.numeric()
B. as.character()
C. as.logical()
D. as.factor()
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The as.character() function is used to convert a numeric variable to a character variable in R.
18. | Which of the following functions is used to sort a vector in ascending order in R? |
---|
A. sort()
B. order()
C. rank()
D. aggregate()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The sort() function is used to sort a vector in ascending order in R.
19. | Which of the following functions is used to remove missing values from a vector in R? |
---|
A. na.omit()
B. complete.cases()
C. is.na()
D. drop_na()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The na.omit() function is used to remove missing values from a vector in R.
20. | Which of the following functions is used to merge two data frames in R based on a common column? |
---|
A. merge()
B. cbind()
C. rbind()
D. bind_rows()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The merge() function is used to merge two data frames in R based on a common column.