Dear all,
This relatively routine analysis has left me frustrated and in a rut. I
have a dataset (data1), which I subset in order to remove rows where
HabitatDensity="Med". This dataset looks correct when I call it up,
however, when I create a table out of the new subset (data2), my table
continues to show the "Med" information as 0.
This is a problem because I need a 2x2xK structure for my analysis and
the fourfoldplot routine, and therefore wish to eliminate data where
HabitatDensity="Med".
Simple question (and probably simple answer): How can I delete the
HabitatDensity=="Med" from the dataset or table, so that I be left
with
a 2x2xK table.
Thanks for any assistance.
Kind regards,
Scott
> data1
Habitat
HabitatDensity
Sex
Grass
High
Male
Grass
High
Female
Grass
Med
Male
Grass
Med
Female
Grass
Low
Male
Grass
Low
Female
Rock
High
Male
Rock
High
Female
Rock
Med
Male
Rock
Med
Female
Rock
Low
Male
Rock
Low
Female
Water
High
Male
Water
High
Male
Water
High
Female
Water
Low
Female
...
> data2 <- subset(data1,
HabitatDensity=="Low"|HabitatDensity=="High",
drop=TRUE)
>data2
Habitat
HabitatDensity
Sex
Grass
High
Male
Grass
High
Female
Grass
Low
Male
Grass
Low
Female
Rock
High
Male
Rock
High
Female
Rock
Low
Male
Rock
Low
Female
Water
High
Male
Water
High
Male
Water
High
Female
Water
Low
Female
...
>table1<-table(data2$Sex, data2$Habitat, data2$HabitatDensity)
>table1
,,= Grass
High
Low
Med
Female
2
2
0
Male
3
2
0
,,= Rock
High
Low
Med
Female
4
1
0
Male
2
1
0
,,= Water
High
Low
Med
Female
5
2
0
Male
3
1
0
[[alternative HTML version deleted]]