[R] Help w/an old R program I've rediscovered and want to make work
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Sat Oct 22 22:28:27 CEST 2011
On Sat, Oct 22, 2011 at 8:41 PM, pce369 <pce369 at hotmail.com> wrote:
> I found an old R program I wrote som eyears back and I'd like to make work in
> 2.11.1 (or a more recent version), but am having two problems:
>
> 1. I can't seem to access the datafile it requires. I'm not sure where the
> default place that R looks to for files references within it is, or what
> exactly the format is for pulling in the data, by my own #comments from a
> few years ago aren't helpful.
R will only look in the current working directory if you don't
specify a full path to read.table. That's the directory you start R
from, or any directory set with setwd("some/path") in an R session.
Suggest you get hunting for your data set...
> 2. Whether or not it's related to the problem locating the data file, the
> error message I get is:
>
> "object of type 'closure' is not subsettable"
You get that if you mistakenly try subsetting a function. I suspect
this is because you try to call your data 'data' and that gets
confused with the data function because the read.table fails. If you
start a fresh R session and do:
data$something
you'll get that message.
R is smart enough though, that if you do create a data frame with the
name 'data' it will go for that if you do data$something...
Barry
More information about the R-help
mailing list