terms.fomula data argument invalid

63 Views Asked by At

I am new to R Studio and now want to make a "cca". I followed a describtion but R says NO. This is what Iam working with:

PreAbscca<- read.table("PreAbsenz.csv", header = TRUE, row.names = NULL)
UVcca<- read.table("UV.csv", header = TRUE, row.names = 1)
cca.all<- cca ( PreAbscca, UVcca )

UVcca are the Environmental Variables like Tree class, Tree diameter, altitude, cover %.. Tree class was numeric so I changed the type of tree in 1,2,3 because I thought it would chance something and would work, but it does not. PreAbscca inclued the incidence of bryophyts. If they appear on the trees yes(1) or no (0). In The List are just numbers.

And R puts out this error:

Error in terms.formula ( object, data = data ) : '.' appears in the formula and 'data' argument is not valid

What can I do, maybe someone can help me this would be nice. Thank u for that

1

There are 1 best solutions below

0
On

Unfortunately your example is not reproducible so I can't test this for myself.

From the error message it seems your input for the cca function is wrong. It is not exactly clear, which package your are using, but I am assuming you are using cca from the vegan package.

The package documentation says about the usage of this function:

"cca"(formula, data, na.action = na.fail, subset = NULL, ...)
"cca"(X, Y, Z, ...)

Which means you either supply input in the form of formula and data or in the form of X,Y,Z.

Here what these inputs need to be:

formula Model formula, where the left hand side gives the community data matrix, right hand side gives the constraining variables, and conditioning variables can be given within a special function Condition. data

data Data frame containing the variables on the right hand side of the model formula.

So in this cas you need supply formula and a data.frame.

X Community data matrix.

Y Constraining matrix, typically of environmental variables. Can be missing. It is better to use formula instead of this argument, and some further analyses only work when formula was used.

Z Conditioning matrix, the effect of which is removed (`partialled out') before next step. Can be missing.

It seems like these need to be supplies as a matrix