You can specify the cases (rows) and variables you want to retrieve using Boolean vectors.
In the following example, R returns the first and second rows, and for each row, we only get the third variable column; we get the third variable alone. R returns the elements corresponding to TRUE:
You can use the same approach for rows also.
If the lengths do not match, R recycles through the Boolean vector. However, it is always good practice to match the size.