Write a R program to create a vector of a specified type and length. Create vector of numeric, complex, logical and character types of length 6
- برمجة R
- 2021-09-05
- adonis77j
الأجوبة
x = vector("numeric", 5)
print("Numeric Type:")
print(x)
c = vector("complex", 5)
print("Complex Type:")
print(c)
l = vector("logical", 5)
print("Logical Type:")
print(l)
chr = vector("character", 5)
print("Character Type:")
print(chr)
Sample Output:
[1] "Numeric Type:" [1] 0 0 0 0 0 [1] "Complex Type:" [1] 0+0i 0+0i 0+0i 0+0i 0+0i [1] "Logical Type:" [1] FALSE FALSE FALSE FALSE FALSE [1] "Character Type:" [1] "" "" "" "" ""
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
معلومات ذات صلة