What is the class defined by the following R code? [code]y<-c(2,”t”)[/code]

What is the class defined by the following R code?
Code:
y<-c(2,”t”)
A. Character
B. Numeric
C. Logical
D. Integer
 
Answer: a
Explanation: Here 2 is changed into character. Since the y belongs to list. A list contains only characters. Combining a numeric object with a character object will create a character vector because numbers can usually be easily represented as strings.
 

Tìm kiếm

Back
Top