I have two variables, see sample table below:
The variable 'vegetation category' represent the vegetation taken at a certain point, and denotes whether that vegetation is 'short', 'medium' or 'tall'.
The variable '50_Short_vegetation' is the proportion of vegetation within a 50metre radius around that same point as above, compared to the other types of vegetation. I.e. in row 1, at the specific location the vegetation was 'Short'. Within the 50m radius around that location, 20% of the vegetation is short.
It seems intuitive to me that this will be correlated, but I'd like to know what test you would use to test this. When I try to use Spearman's in R, I get the following error:
Error in cor.test.default(denran8$short_50,denran8$vegcat,method = "spearman") : 'y' must be a numeric vector
A sample of my data if helpful:
structure(list(vegcat = structure(c(3L, 3L, 3L, 3L, 2L, 2L), .Label = c("1", "2", "3"), class = "factor"), short_50 = c(0, 0.77778, 0.5, 0.44444, 0, 0)), row.names = c(NA, 6L), class = "data.frame")
Note- S is represented by '1', M by '2', and T by '3'.