Skip to content
Prev 204428 / 398500 Next

Object of type 'closure' not subsettable

On Sun, Dec 20, 2009 at 7:40 PM, Muhammad Rahiz
<muhammad.rahiz at ouce.ox.ac.uk> wrote:
No it doesn't. It copies the object called 'file' into an object
called 'd2'. What's the object called 'file'? If you've not created
one already, its the 'file' function that R uses to read stuff from
files. So when you do:
you are trying to subset from d2 (and from 'file'). If I do this:

 > file[[2]]

 I get your error message:

Error in file[[2]] : object of type 'closure' is not subsettable

 So clearly you aren't doing what you think you're doing.

 Some hints:

1. Read a good introduction to R. You are making a number of
fundamental mistakes here.

2. Run each line separately and check what value you get back by printing it.

3. Don't give your objects the same name as R functions (you're using
'seq', 'file', and 'mean'). Although this may work, it will confuse
people later...

Barry