Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lab 9: practice with functions Some tips to make your functions a little more interesting.

Similar presentations


Presentation on theme: "Lab 9: practice with functions Some tips to make your functions a little more interesting."— Presentation transcript:

1 Lab 9: practice with functions Some tips to make your functions a little more interesting

2 Some advice before we start For this lab, the code file will be much more useful than the slides We'll post solutions to all of the problems, but try a few of them on your own first These techniques will make it easier to write functions, but you already know enough to do the assignment! This is just the delicious icing on the cake!

3 Applying functions for functional applications The apply() family of functions allows you to carry out a single function multiple times on a dataset  e.g., get the means of the rows of a dataset You can accomplish the same thing with a for loop, but apply() is faster

4 Conditioning for success We can use more interesting conditionals  x & y → x and y  x | y → x or y  !x → not x See the code file for how to subset a vector using conditionals

5 Making plots R has the ability to make lots of really nice plots Some commands you might us are:  plot()  hist()  barplot()


Download ppt "Lab 9: practice with functions Some tips to make your functions a little more interesting."

Similar presentations


Ads by Google