Dear Community, I have a dataframe like this one: A B 5 1 6 1 7 1 8 1 9 2 10 2 11 2 12 2 I have a problem splitting up the above data frame in respect to the factor represented by B, whereas the resulting vector should contain the numeric values only. I tried split() but it produces this: A B [1] 5 1 6 1 7 1 8 1 [2] 9 2 10 2 11 2 12 2 I want to achieve this,though: A [1] 5 6 7 8 [2] 9 10 11 12 How is this done? Thank you very much in advance. Best Regards.
split data frame by factor
2 messages · Ivan
sorry, the problem has been solved.
On Mon, Apr 25, 2011 at 11:28 PM, ivan <i.petzev at gmail.com> wrote:
Dear Community, I have a dataframe like this one: A ? ? ? B 5 ? ? ? 1 6 ? ? ? 1 7 ? ? ? 1 8 ? ? ? 1 9 ? ? ? 2 10 ? ? ?2 11 ? ? ?2 12 ? ? ?2 I have a problem splitting up the above data frame in respect to the factor represented by B, whereas the resulting vector should contain the numeric values only. I tried split() but it produces this: A ? ? ? B [1] 5 ? ? ? 1 6 ? ? ? 1 7 ? ? ? 1 8 ? ? ? 1 [2] 9 ? ? ? 2 10 ? ? ?2 11 ? ? ?2 12 ? ? ?2 I want to achieve this,though: A [1] 5 6 7 8 [2] 9 10 11 12 How is this done? Thank you very much in advance. Best Regards.