Statistical test for logical vectors in R The first issue that I feel like I have is that I have limited experience with actually using statistical tests. I apologize ahead of time if this question is illogical.
I have two example vectors below:
A = 0,0,0,0,1,1,0,0,1,0,1,0,0,0,1,1,0,0,1,0,0,1,0,1,0,1
B = 1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,1,0,0,1,1,0,1

1 representing a situation in which an event occurs and 0 representing a situation in which an event does not occur. What I know tells me "To find if there is a significant difference between the two groups, run a t-test". The problem that I see is that these numbers represent TRUE or FALSE values rather than quantifiable data, if that makes sense. These numbers could just as easily be 100 and 0 and the logic would technically hold.
I don't know if there is a test that examines the difference in TRUE vs. FALSE occurrences between two groups, so I thought that I would ask here.
If it helps the post make sense, I have two types of plants in a plot that I examine weekly for insect eggs. If there are eggs, the value is 1. If there are no eggs, the value is 0. I am trying to see if there is a statistically significant difference between groups A and B in terms of whether or not eggs were laid.
 A: The question is, what exactly do you want to test?
In short: you can use the Pearson's Chi squared test: prop.test() to test if the probability of success is the same in both samples. Here is the corresponding code for your data:
# Assign your data correctly:
A  <- c(0,0,0,0,1,1,0,0,1,0,1,0,0,0,1,1,0,0,1,0,0,1,0,1,0,1)
B  <- c(1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,1,0,0,1,1,0,1)

# Get number of successes for A:
suc.A <- sum(A)
# Number of trials in A:
trial.A <- length(A)

# same for B:
suc.B <- sum(B)
trial.B <- length(B)

# apply Pearson's Chi-squared test:
prop.test(x=c(suc.A, suc.B), n=c(trial.A, trial.B))

# Or in short:
prop.test(c(sum(A),sum(B)), c(length(A), length(B))

So the test says there is no significant difference in the probability of success, although the empirical difference is almost 20% -- false of too little data I suppose.
More general information: The data you describe is called "binary" as it has just two outcomes. This is also why the t-test is not appropriate. A typical distribution for binary data would be the binomial distribution. You can google it and you will find a lot of information about it. Note, that not all binary data is always binomially distributed. E.g. if your data has autorcorrelation (many zero's in a row, many ones in a row) or a trend towards zero or towards one, this would not be binomial because the probability of success is not constant.
In case you also have information of the joint distribution of A and B (how often is A a success when B is and vice-versa) you could test their relation using fisher exact test. See ?fisher.test
See also the following discussions:
Comparing two binary distributions
Test if two binomial distributions are statistically different from each other
