I have a data frame with a number of observed and predicted values by classification as shown below:

        Count   Volume  FCLASS
1      55000   60000   Grade Separated
2      43000   39000   Grade Separated
3      26000   26500   Major Arterial
4      19500   20000   Major Arterial
...

There are four classes here: Grade Separated, Major Arterial, Minor Arterial, and Collector

I am looking to compute the following information

FCLASS                   cor(Count,Volume)
Grade Separated   0.999
Major Arterial         0.999
Minor Arterial         0.999
Collector                 0.999

I am attempting to use the following commands to achieve this:

library(reshape)
tmp <- melt(dataframe)
cast(tmp, FCLASS ~ variable, function(Count, Volume) cor(Count, Volume))

but this is generating: Error in is.data.frame(y) : argument "Volume" is missing, with no default

Any suggestions?

Walter Anderson

______________________________________________
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.

Reply via email to