From the course: R for Data Science: Analysis and Visualization

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Piping commands with |

Piping commands with |

- [Instructor] Sometimes code can be difficult and this can be as true for R as for anything else. And one of the places where this is most apparent is with nested commands. So for example, here's a command I used once for some analysis, and the important thing is that in Base R, it starts in the middle and then goes out. So for instance, right here it says use the data from UCBAdmissions. That's a dataset in the R datasets package. Then I apply a function called margin.table to it. And then I have an argument a couple steps over that says use table or margin three. Alright, so we apply that to UCBAdmissions but then I want to do something to that. I convert it to a proportion table and then I want to round it to two decimal places. And you can see, those are really, really far apart from each other. And then finally, I take the whole thing and multiply it times a hundred to get it so it's like percentages. This is a…

Contents