Using both i and j

Let’s combine what we’ve learned about the first two-thirds of the allowable square bracket expressions by using both i and j in the same statements, as shown in the following code:

> tracks[artist=="Belle and Sebastian", trackname][1] "A Century Of Elvis" "A Century Of Elvis" "Dog On Wheels"...> tracks[artist=="Belle and Sebastian", .(artist, trackname)]                   artist                             trackname   1: Belle and Sebastian                    A Century Of Elvis   2: Belle and Sebastian                    A Century Of Elvis   3: Belle and Sebastian                         Dog On Wheels   4: Belle and Sebastian                         Dog On Wheels   5: Belle and Sebastian                    The Power Of Three  ---                                                         5553: Belle and Sebastian                               Fiction5554: Belle and Sebastian                    Your Cover’s Blown5555: Belle and Sebastian         I Don’t Want To Play Football5556: Belle and Sebastian ...

Get Data Analysis with R - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.