why am I getting char as output for typeof function when I have passed a numeric vector?

Viewed 24

In this vec1 is numeric vector and vec2 is character vector but the output of typeof is the other way around when I pass vec1 to typeof function I am getting this output but vec1 is numeric vector this is the output of the program

vec1=c(1,2,3)
vec2=c("R","py","JAva","C++")
vec3=c("eeee","eeeee","rrrrr","ggggg"#)
typeof(vec1) #this should be printing the data type used in vec1 but the output shows that it's a character vector 
length(vec2)
class(vec1)
str(vec2)
df = data.frame(vec1,vec2,vec3)
print(df)

output:

chr [1:3] "R" "py" "JAva" //here it should be numeric instead of char right ?
0 Answers
Related