any great command to share with me on splitting data in R software.

Example
Treatment: 1,0,1,1,1,0,0,1.....
variable: 2,6,9,1,3,7,8,9.....

What if I want to filter and check the various statistics for only the treatment group. E.g.treatment==1.