Cross tabulation of two variables with resulting average and SD I am beginner of R software. I am looking for two variables and result cross tabulated but not in the form of frequencies. Could I get help on how to get result as average and standard deviation instead of frequencies while cross tabulating in R.
my data looks like this
Treatment   Stage   Chlorophyll
Salt        Green   0.2
Salt        Green   0.3
Salt        Green   0.4
Salt        Pink    0.5
Salt        Pink    0.3
Salt        Pink    0.2
Salt        Red     0.5
Salt        Red     0.6
Salt        Red     0.7
Nitrogen    Green   0.4
Nitrogen    Green   0.6
Nitrogen    Green   0.9
Nitrogen    Pink    0.2
Nitrogen    Pink    0.3
Nitrogen    Pink    0.5
Nitrogen    Red     0.4
Nitrogen    Red     0.2
Nitrogen    Red     0.3
Control     Green   0.5
Control     Green   0.6
Control     Green   0.8
Control     Pink    0.5
Control     Pink    0.4
Control     Pink    0.6
Control     Red     0.2
Control     Red     0.3
Control     Red     0.1

I appreciate help from this community.
 A: If your data is in a data frame called, say Chlordata, you can do:
 with(Chlordata, tapply(Chlorophyll, list(Treatment=Treatment,Stage=Stage), mean) )

to get a table of means:
          Stage
Treatment      Green      Pink Red
  Control  0.6333333 0.5000000 0.2
  Nitrogen 0.6333333 0.3333333 0.3
  Salt     0.3000000 0.3333333 0.6

and similarly 
 with(Chlordata, tapply(Chlorophyll, list(Treatment=Treatment,Stage=Stage), sd) )

to get a table of standard deviations:
          Stage
Treatment      Green      Pink Red
  Control  0.1527525 0.1000000 0.1
  Nitrogen 0.2516611 0.1527525 0.1
  Salt     0.1000000 0.1527525 0.1

You might also want to investigate xtabs, for example, you could do something like this:
nn=xtabs(~Treatment+Stage,Chlordata)
xtabs(Chlorophyll~Treatment+Stage,Chlordata)/nn

to get a table of means.
A: data.table package is very useful for such tasks. You can get both mean and SD in one go. Assuming your data.frame is ddf:  
> ddt = data.table(ddf)
> ddt[,list(mean=mean(Chlorophyll), sd=sd(Chlorophyll)),by=list(Treatment, Stage)]
   Treatment Stage      mean        sd
1:      Salt Green 0.3000000 0.1000000
2:      Salt  Pink 0.3333333 0.1527525
3:      Salt   Red 0.6000000 0.1000000
4:  Nitrogen Green 0.6333333 0.2516611
5:  Nitrogen  Pink 0.3333333 0.1527525
6:  Nitrogen   Red 0.3000000 0.1000000
7:   Control Green 0.6333333 0.1527525
8:   Control  Pink 0.5000000 0.1000000
9:   Control   Red 0.2000000 0.1000000

Looking forward to your approach to displaying and analyzing this data.
