This is an old revision of the document!


Subsetting

To subset data, we use the subset() command. The syntax of this function is that you tell it the name of the dataset you want to subset, then you tell it the rule for subsetting. So if we want to see the part of the labike dataset that has bike counts of more than 300, we do this:

subset(labike, bike_count_pm > 300)

As always, this is just printing into the Console, so if we want to save the subset for later use we need to name it something

LotsOfBikes = subset(labike, bike_count_pm > 300)

Now it will appear in your Workspace tab, and if you want to see it you can click on LotsOfBikes to see it.

Print/export