Q:

Write a R program to convert given dataframe column(s) to a vector

0

Write a R program to convert given dataframe column(s) to a vector.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

dfc1 = c(1, 2, 3, 4, 5)
dfc2 = c(6, 7, 8, 9, 10)
dfc3 = c(11, 12, 13, 14, 15)
dfc4 = c(16, 17, 18, 19, 20)
v <- data.frame(dfc1=1:5, dfc2=6:10, dfc3=11:15, dfc4=16:20)
print(v)

Sample Output:

dfc1 dfc2 dfc3 dfc4
1    1    6   11   16
2    2    7   12   17
3    3    8   13   18
4    4    9   14   19
5    5   10   15   20

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now