I have a dataset of 3 columns and 5 rows.
temp-data.frame(col1=c(5,10,14,56,7),col2=c(4,2,8,3,34),col3=c(28,4,52,34,67))
I wish to convert this to a single column, with
column 1 on top and column 3 on bottom.
i.e.
5
10
14
56
7
4
2
8
3
34
28
4
52
34
67
Are there any functions that do
r user [EMAIL PROTECTED] writes:
I have a dataset of 3 columns and 5 rows.
temp-data.frame(col1=c(5,10,14,56,7),col2=c(4,2,8,3,34),col3=c(28,4,52,34,67))
I wish to convert this to a single column, with
column 1 on top and column 3 on bottom.
i.e.
5
10
14
56
7
4
2
8
temp-data.frame(col1=c(5,10,14,56,7),col2=c(4,2,8,3,34),col3=c(28,4,52,34,67))
temp
col1 col2 col3
154 28
2 1024
3 148 52
4 563 34
57 34 67
as.numeric(as.matrix(temp))
[1] 5 10 14 56 7 4 2 8 3 34 28 4 52 34 67
?unlist
temp-data.frame
(col1=c(5,10,14,56,7),col2=c(4,2,8,3,34),col3=c(28,4,52,34,67))
temp
col1 col2 col3
154 28
2 1024
3 148 52
4 563 34
57 34 67
unlist(temp)
col11 col12 col13 col14 col15 col21 col22 col23 col24 col25 col31 col32
col33 col34
] Converting from a dataset to a single column
I have a dataset of 3 columns and 5 rows .
temp-data.frame(col1=c(5,10,14,56,7),col2=c(4,2,8,3,34),col3=c(28,4,5
2,34,67))
I wish to convert this to a single column , with
column 1 on top and column 3 on bottom .
i.e.
5
10
14
56
7