'Error messages of two sample t test/ txt file dataset

I got an error message after I used t.test() on my datasets. The dataset is a txt file, the t.test function works well on other types of datasets like dat and csv

Here's my code:

petro <- read.table(file.choose(), header = TRUE, sep = "\t")
head(petro)

# two independent sample t test
t.test(petro$Canberra, petro$Perth, var.equal = TRUE)

After I run the t.test function, the error message was like:

*Error in if (stderr < 10 * .Machine$double.eps * abs(mx)) stop("data are essentially constant") : 
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In mean.default(x) : argument is not numeric or logical: returning NA
2: In var(x) : NAs introduced by coercion*

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source