Reputation: 59
I tried to merge two tables, but the result is like this,
subj gamble_gamble n_gambles expected_value
1 19 32 1.7
10 3 4 1.5
100 3 4 1.5
101 6 32 1.4
102 3 4 1.5
103 19 32 1.7
The subj
column isn't ordered in usual way (e.g. 1,2,3,4,5,6). I tried to order the subj
column with this command:
newdata <- table3[order(subj),]
but it doesnt work. Can somebody help me?
Upvotes: 0
Views: 111
Reputation: 12819
Use this:
newdata <- table3[order(as.numeric(as.character(table3$subj))),]
This works even if subj
is a factor
(not just character
).
Upvotes: 2