[R] wroung groupedData despite reading Bates and Pinheiro 3 times

0 views
Skip to first unread message

hpdutra

unread,
Jul 19, 2008, 4:02:49 PM7/19/08
to r-h...@r-project.org

Hi everyone. I am trying to add a formula to my data using the groupedData
function.
My experiment consists of randomized block design using fruits, vegetation
and time as factors. The idea is to see if fruits, vegetation and time
explain the abundance of mice. I am using tree density as a covariate.
So I tried to fit the following structure to my data.
> traps<-groupedData(mice~tree|plotID,outer=~time*fruit*veget|block,data=trap)

but time and block are still considered to be numeric, while in fact they
should be factor and ordered, respectively.
> sapply(traps,data.class)
mice plotID veget fruit time block tree
"numeric" "ordered" "factor" "factor" "numeric" "numeric" "numeric"

Is there a way to change that?

Thank you very much.

PS: the levels for fruit and veget are intact or removed
--
View this message in context: http://www.nabble.com/wroung-groupedData-despite-reading-Bates-and-Pinheiro-3-times-tp18548213p18548213.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-h...@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.

milton ruser

unread,
Jul 19, 2008, 4:17:48 PM7/19/08
to hpdutra, r-h...@r-project.org
Hi (sorry, I don´t got your name)

May be this help you.

trap$time<-factor(trap$time)
trap$block<-factor(trap$block)


All the best,

miltinho astronauta
brazil

[[alternative HTML version deleted]]

hpdutra

unread,
Jul 19, 2008, 4:43:04 PM7/19/08
to r-h...@r-project.org

Hi Milton, I tried this and it worked.
But the block structure isn't right because when I try to plot this I still
get an error message
traps<-groupedData(mice~tree|plotID,outer=~time*fruit*veget|block,data=trap)
> plot(traps,outer=T)
I guess my question is should I try to fit a more simple grouped data
structure and leave the formula of my model to deal with it?
All I want is to generate a 3 graphs, one for each block, with mice as the
response variable, time as the x axis and the different treatments as lines.
I know I can do that using lattice. But I want to run my model after that,
so I need to get the groupedData correct.

Thank you very much

Humberto Dutra


try

trap$time<-factor(trap$time)
trap$block<-factor(trap$block)


On 7/19/08, hpdutra <hpd...@yahoo.com> wrote:
>
>
> Hi everyone. I am trying to add a formula to my data using the
> groupedData
> function.
>

> So I tried to fit the following structure to my data.
> >
> traps<-groupedData(mice~tree|plotID,outer=~time*fruit*veget|block,data=trap)
>
> but time and block are still considered to be numeric, while in fact they
> should be factor and ordered, respectively.
> > sapply(traps,data.class)
> mice plotID veget fruit time block tree
> "numeric" "ordered" "factor" "factor" "numeric" "numeric" "numeric"
>
>

--
View this message in context: http://www.nabble.com/wroung-groupedData-despite-reading-Bates-and-Pinheiro-3-times-tp18548213p18548416.html

Reply all
Reply to author
Forward
0 new messages