[R] subset factor?

2011-01-14 Thread Silvano

Hi,

I used subset command, like this:

grupoP = subset(dados, grupos=='P',  select=c(mortos, vivos, 
doses, percevejos, p))


and the variables in select option are numeric.

I tried fit a model with command:

ajuste.logit = glm(cbind(mortos,percevejos)~log10(doses), 
family=binomial(logit), data=grupoP)


and the output is:

ajuste.logit = glm(cbind(mortos,percevejos)~log10(doses), 
family=binomial(logit), data=grupoP)
Erro em Math.factor(doses) : log10 not meaningful for 
factors


what is wrong with my commands? Why doses aren't numeric?

Thanks,

--
Silvano Cesar da Costa
Departamento de Estatística
Universidade Estadual de Londrina
Fone: 3371-4346

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] subset factor?

2011-01-14 Thread Sarah Goslee
Are you certain they are numeric? Have you tried
str() on your data?

Sarah

On Fri, Jan 14, 2011 at 9:08 AM, Silvano silv...@uel.br wrote:
 Hi,

 I used subset command, like this:

 grupoP = subset(dados, grupos=='P',  select=c(mortos, vivos, doses,
 percevejos, p))

 and the variables in select option are numeric.

 I tried fit a model with command:

 ajuste.logit = glm(cbind(mortos,percevejos)~log10(doses),
 family=binomial(logit), data=grupoP)

 and the output is:

 ajuste.logit = glm(cbind(mortos,percevejos)~log10(doses),
 family=binomial(logit), data=grupoP)

 Erro em Math.factor(doses) : log10 not meaningful for factors

 what is wrong with my commands? Why doses aren't numeric?

 Thanks,




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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] subset factor?

2011-01-14 Thread Peter Ehlers

On 2011-01-14 06:20, Sarah Goslee wrote:

Are you certain they are numeric? Have you tried
str() on your data?

Sarah



Silvano:

As Sarah says, do str(dados) to see that 'doses' is
NOT numeric. The error message is very clear; it tells you
that 'doses' is a factor. My guess is that you imported
your data from somewhere and somehow managed to import
'doses' as a factor. My advice is to ALWAYS do an str()
after importing/changing data.

Peter Ehlers


On Fri, Jan 14, 2011 at 9:08 AM, Silvanosilv...@uel.br  wrote:

Hi,

I used subset command, like this:

grupoP = subset(dados, grupos=='P',  select=c(mortos, vivos, doses,
percevejos, p))

and the variables in select option are numeric.

I tried fit a model with command:

ajuste.logit = glm(cbind(mortos,percevejos)~log10(doses),
family=binomial(logit), data=grupoP)

and the output is:


ajuste.logit = glm(cbind(mortos,percevejos)~log10(doses),
family=binomial(logit), data=grupoP)


Erro em Math.factor(doses) : log10 not meaningful for factors

what is wrong with my commands? Why doses aren't numeric?

Thanks,







__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] subset factor?

2011-01-14 Thread Erik Iverson



Silvano wrote:

Hi,

I used subset command, like this:

grupoP = subset(dados, grupos=='P',  select=c(mortos, vivos, doses, 
percevejos, p))


and the variables in select option are numeric.


They may *look* numeric, but are they really?  You don't give us
enough information to determine that.  Either give us a sample
of your data with the dput command, or the output of str(grupoP).

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.