If you order your factor levels in your vectors in the order you want in the
output,
then the prop.table(prop()) command will give you what you want.
But you have to reorder the factor levels so that the levels commands give the
following output:
levels(trans$class)
[1] seed veg repr
Hi Peter,
Thanks for pointing out the set functions. I can use setdiff to find
missing rows
setdiff(dev, rownames(A))
[1] seed
and intersect to find common rows
d1- intersect(dev, rownames(A) )
[1] veg rep
I was trying to use a negative index like A[-1,] to remove the dead row,
but d1 is a
Hi,
I would like to construct a transition matrix from a data frame with
annual transitions of marked plants.
plant-c(1:6)
class-c(seed,seed, seed, veg, rep, rep)
fate-c(dead, veg,veg,rep, rep, veg)
trans-data.frame(plant, class, fate)
plant class fate
1 1 seed dead
2 2 seed veg
Hi again,
I almost figured this out, but still need some help on the last part.
I can use prop.table to get survival probabilities...
A - t(prop.table( table(trans$class, trans$fate),1) )
rep seed veg
dead 0.000 0.333 0.000
rep 0.500 0.000
Chris Stubben [EMAIL PROTECTED] writes:
Hi again,
I almost figured this out, but still need some help on the last part.
I can use prop.table to get survival probabilities...
A - t(prop.table( table(trans$class, trans$fate),1) )
rep seed veg
dead 0.000