0

I get the following error message when I try to run a t-test in R:

t.test(tsEN$trans.size, tsNEN$trans.size, mu=0, var.equal = TRUE)

Error in if (stderr < 10 * .Machine$double.eps * max(abs(mx), abs(my))) stop("data are essentially constant") : missing value where TRUE/FALSE needed

My dataset is enormous (~3000 rows) but the first few lines in the column of interest are:

head(tsEN)
  trans.size
1        0.6931472
2        0.6931472
3        2.3025851
4        2.7080502
5        2.5649494
6        1.0986123

and for the second one:

head(tsNEN)
  trans.size
1         2.197225
2         2.302585
3         2.484907
4         2.079442
5         2.197225
6         2.484907

From previous questions on this subject it seems like the problem is normally that there are non-numerical elements in the data; however this doesn't seem to be the case here. I already took out all the NA's; what is left should only be numbers.

This data concerns a specific species; I ran t-tests on 3 other species where the data frames were set up identically and I ran into no issues, so... I'm stumped.

M M R
  • 1
  • 1
  • What does `str(tsEN)` and `str(tsNEN)` tell you? – Roland Feb 16 '17 at 07:29
  • 2
    Your data is character strings, or possibly factors, not numbers. I can tell this from the spacing padding the `head` printout, and if I make an example data frame with character strings I get the same error. Always check your data with tools like "summary" and "str" to make sure they are what you expect. – Spacedman Feb 16 '17 at 08:00

0 Answers0