Skip to content
Prev 165275 / 398506 Next

How to do indexing after splitting my data-frame?

'str' is your friend when trying to understand what the difference is:
$`1`
    a b
1   1 1
2   2 1
5   5 1
10 10 1

$`2`
  a b
3 3 2
4 4 2
6 6 2
7 7 2
8 8 2
9 9 2
List of 1
 $ 1:'data.frame':      4 obs. of  2 variables:
  ..$ a: int [1:4] 1 2 5 10
  ..$ b: int [1:4] 1 1 1 1
'data.frame':   4 obs. of  2 variables:
 $ a: int  1 2 5 10
 $ b: int  1 1 1 1
NULL
[1]  1  2  5 10
Notice that x.s['1'] returns a 'list', while x.s[['1']] returns a
dataframe which is probably what you were expecting.


On Sat, Dec 20, 2008 at 4:10 PM, Oliver Bandel
<oliver at first.in-berlin.de> wrote: