Good morning,
I wanted to do a Friedman test (from "stats" package) on my data about the leaves of dandelions, but an error is displayed.
My data has the form:
> str (mi)
'data.frame': 4393 obs. of 18 variables:
$ OS_Gatunek : Factor w/ 5 levels "Taraxacum ancistrolobum",..: 1 1 1 1 1 1 1 1 1 1 ...
$ PH_CreateDate : Factor w/ 15 levels "2016-04-06","2016-04-19",..: 2 2 2 2 2 2 2 2 2 2 ...
$ L_Dl : num 7.91 8.96 10.18 10.09 9.4 ...
$ L_SzerMaksOs : num 1.93 3.98 3.12 4.04 2.75 2.69 3.69 3.23 2.3 2.49 ...
$ L_DlMax : num 3.51 4.08 5.58 5.04 3.99 3.6 5.65 4.62 3.33 4.18 ...
$ KS_DlSk_Sr : num 1.78 3.28 2.88 4.19 1.88 2.47 3.11 4.04 1.61 2.09 ...
$ KS_Dl_Sr : num 1.68 2.83 2.62 3.84 1.68 2.12 2.87 3.8 1.44 1.86 ...
$ KS_Sz : num 1.35 3.41 2.38 3.31 1.66 2.35 2.45 2.96 1.57 1.9 ...
$ KB_DlSkos_Sr : num 1.07 1.94 1.84 1.69 1.25 1.49 1.96 1.77 1.43 1.55 ...
$ KB_Dl_Sr : num 0.62 1.49 1.12 1.34 0.86 0.77 1.22 1.07 0.82 1.05 ...
$ KB_Szer_Sr : num 0.85 1.23 1.46 0.94 0.89 1.32 1.53 1.41 1.17 1.14 ...
$ KB_SzerPierwKlapy: num 1.75 3.99 2.9 4.1 2.34 2.75 3.11 3.39 1.96 2.46 ...
$ I_Dl_Sr : num 0.25 0.86 0.48 0.61 0.44 0.41 0.7 0.86 0.14 0.59 ...
$ I_SzOs : num 0.37 0.83 0.47 0.87 0.39 0.73 0.53 0.96 0.4 0.33 ...
$ I_DlSz_Sr : num 2.3 4.08 3.35 5.23 2.34 3.39 3.22 4.43 1.96 2.55 ...
$ O_Dl_Sr : num 0.67 0.75 2.02 0.85 0.74 1.4 1.07 0.26 0.6 0.96 ...
$ O_SzerOs : num 1.35 1.59 1.31 0.91 1.08 0.94 1.18 0.84 1.71 0.93 ...
$ O_SzerOskrz_Sr : num 0.55 0.65 0.48 0.34 0.39 0.31 0.49 0.29 0.74 0.27 ...
The first two columns are indications of my species and dates of measurements, while the others are measurements of various leaf elements (in cm). I will add that the data is mixed up with lines (they are not arranged according to any key).
Typing (as prompted):
> friedman.test(mi$L_Dl, groups=mi$OS_Gatunek, blocks=mi$PH_CreateDate)
R prints an error message:
Error in friedman.test.default(mi$L_Dl, groups = mi$OS_Gatunek, blocks = mi$PH_CreateDate) :
not an unreplicated complete block design
I checked, but this is not a problem:
- nor too long string of characters in column 1,
- nor spaces in the same place,
- nor a pause in column 2.
R something compute (but not as I want) if:
- I transform the tested columns into a matrix (then treats numeric as
characters),
- I execute cbind() on the tested columns (then it encodes the species/date names into a numeric form and calculates them as if they were numbers).
I have no other ideas how to solve my problem. I am asking for suggestions.
Regards
Olga Świder