Problems in chisq.test in R I have two groups of samples, NGHC (n=14) and NHC (n=87). The result of the samples CO.05 should be 0 or 1. For example, the results can be
        0     1
 NGHC  11     3
 NHC   87     0

This is a subset of my data frame,
df <- structure(list(CLASS = c("NGHC", "NGHC", "NGHC", "NGHC", "NGHC", 
"NGHC", "NGHC", "NGHC", "NGHC", "NGHC", "NGHC", "NGHC", "NGHC", 
"NGHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", 
"NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", 
"NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", 
"NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", 
"NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", 
"NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", 
"NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", 
"NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", 
"NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC", 
"NHC", "NHC", "NHC", "NHC", "NHC", "NHC", "NHC"), CO.05 = c(0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), class = "data.frame", row.names = c(NA, 
-101L))

The cross-tabulation of the df
table(df$CLASS, df$CO.05)
        0
  NGHC 14
  NHC  87

when I try to calculate the chi-square of this data frame,
summary(table(df$CLASS, df$CO.05))

it returns
Number of cases in table: 101 
Number of factors: 2 
Test for independence of all factors:
Chisq = 2.2539e-31, df = 0, p-value = 0

It is should be a table of 2x2. Shouldn't the p-value = 1?
(Can I ask an additional question here? If not I will delete this
Question:
Since the samples of these two groups are imbalanced (14 vs 87), is chi-square the correct statistics method to compare the significance between these two groups?)
 A: First things first. You seem to be new to both statistics and R. In the long run you'll be more effective at learning both if you start with the basics. A free resource I like is Modern Statistics with R.
Now to your question. There are no problems with chisq.test function, you have data issues and gaps in your knowledge.
You expect a 2✕2 table but get a 2✕1 table because the CO.05 column in your data frame contains only zero. Where are the three 1s you expect? We don't know and it's up to you to investigate what happened.
# Two ways to create a contingency table from a matrix:
table(df)
#>       CO.05
#> CLASS   0
#>   NGHC 14
#>   NHC  87
xtabs(~ CLASS + CO.05, data = df)
#>       CO.05
#> CLASS   0
#>   NGHC 14
#>   NHC  87

If you know what the 2✕2 table is, you can create it by hand.
# Create a 2x2 table from a list of 4 values.
# Use the `byrow` argument to specify that the 4 values are ordered by column.
table2x2 <- matrix(
  c(11, 87, 3, 0),
  nrow = 2, ncol = 2,
  byrow = FALSE
)
table2x2
#>      [,1] [,2]
#> [1,]   11    3
#> [2,]   87    0

Hard-coding the table is error-prone; it's better to contract the contingency table from data. But in this case you seem to not have the right data.
Perform chi-square test:
chisq.test(table2x2)
#> Warning in chisq.test(table2x2): Chi-squared approximation may be incorrect
#> 
#>  Pearson's Chi-squared test with Yates' continuity correction
#> 
#> data:  table2x2
#> X-squared = 12.498, df = 1, p-value = 0.0004074

The p-value is 0.0004, not 1. I'll just point out but not explain three important details:

*

*There is a warning that the chi-squared approximate might not hold. (This warning can come up when there are very small counts; see reference below as well as the comments by @whuber and @NuclearHoagie.)

*The reported p-value is approximate, not exact. As @whuber points out, the approximation is not very close.

*The test was performed with Yates' continuity correction.

These details are important but more advanced; it's better to learn the basics first. And definitely don't proceed with further analyses if there are warnings in the output.
It's not clear why you think the p-value should be 1; it's best to avoid hunches about p-values altogether. This and the fact you ask how to "compare the significance between these two groups" suggests that you don't understand p-values and hypothesis testing. I suggest you learn more about both concepts before trying to draw conclusions from statistical tests. Here are two CV posts you could start with:
What is the meaning of p values and t values in statistical tests? 
Find Statistical Significance of Binary Data 
Warning in R - Chi-squared approximation may be incorrect 
PS. The title of the second question is unfortunate because data is neither significant nor insignificant. It's whatever we observe it to be.
