Messaging Apps powered by Machine Learning

Subset extraction

Subsetting works the same as in R.

Column selection

For data frames, a single column can be extracted using the $ operator.

For multiple columns, use square brackets.

Row selection

As in R, head and tail show portions of a vector or data frame.

Specific rows can be accessed using their ordinal positions or index if it exists.

Logic operations

Set operations

Let x = -5..5.

Set membership

We can determine if a value is in a set using the E operator. This character is chosen because its glyph resembles \in.

For vectors, each element will be tested for set membership.

Subsets

What if we want to know if one set is a subset of another? The C operator (which resembles \subset) can be used.