[R] Translation of R code required

Sarah Goslee sarah.goslee at gmail.com
Fri Nov 3 19:12:19 CET 2006


On 11/3/06, Sarah White <swhite at sgul.ac.uk> wrote:
>
> I am using Windows XP, R version 2.4.
>
> The code works until I get to the fourth line starting
>
> model.effect
>
> and I receive the following Error message.
>
> Error in eval(expr, envir, enclos) : object "Centre" not found
>


It sounds like the variable names aren't what you think they are.
Try this:

mental <- read.csv("dataextract.csv")
colnames(mental)

If the names don't match exactly, R won't know what you mean.

Since this step works,

mental$Rx <- factor(mental$Rx, levels=c("VS","IPS"))

I think that some of the names are right, but perhaps that
one is spelled differently (Centre vs centre, maybe, since
R is case-sensitive?).

The easiest thing to do with no R knowledge is probably
to change the name in the csv file to match your code,
if that turns out to be the problem.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list