Can somebody help me with a t-test

Im doing an unpaired t-test.
And I wish to do a comparison of means for column 1, when column 2 is 1 and or/and 0.
Can anyone tell me how I do that.
I’ve allready done the t-test. Ive used the code:
t.test(C1, C2==1, na.rm=TRUE, mu=0, conf.level = 0.95)
And again
t.test(C1, C2==0, na.rm=TRUE, mu=0, conf.level = 0.95)
But the mean seems to be too high, so I suspect that it dosent understand that it has to be when 1 or 0. Besides that I wish the output to tell me what the exact comparison of mean is for C1 and C2 when C2 is 1 or 0.
I hope someone can help me, thanks

Hi Nancy,
Welcome to the forum.

We really should have more information about your code and data. Have a look at FAQ: How to do a minimal reproducible example ( reprex ) for beginners