Skip to content

Details

Stephanie Kirmer will be giving a workshop about writing functions. We'll discuss when you need to write a function, how they're written, documenting and writing tests for your functions.

Speaker Info:
Stephanie Kirmer is a Senior Data Scientist at Saturn Cloud, a company making large scale Python easy and accessible to the data community using Dask. She has used R as well as Python for machine learning and data science throughout her career, including as a DS Tech Lead at a travel data startup, and as a Senior Data Scientist at Uptake, an industrial data science company. She holds Master's degrees in sociology and education and was formerly an adjunct faculty member at DePaul University in Chicago.
https://skirmer.github.io

======================================
Register to receive the event Zoom link

Spring 2021 RLEL/RLC event registration link:
https://forms.gle/ZLo6XEUVrz9eCLrQ8

========
AGENDA

Introduction

  • from RL
  • from Speaker, Stephanie Kirmer

Overview

  • What we’re going to discuss today

Why Functions?

  • What purpose do they serve?
  • When do you need to use one?

Basic Structure

  • Share an example and talk through the pieces

[* hands-on, beginner: take the example and run it, see what it does, and make sure you know why it does that

  • hands-on, advanced: take a snippet of code you have used in the past that produces a result, and wrap it up to be a function without any input or return just yet.]

What Goes In

  • How you shape inputs to functions, knowing what objects and types you want to accept
  • Accepting lists of objects
  • hands-on, beginner: take a new example, try passing in a single obj versus a list
  • hands-on, advanced: add an input argument to your new function, decide what it should be, and see how it works.

What Comes Out

  • What to return, what types and objects you can give back
  • Giving back lists of objects

[* hands-on, beginner: change the example so it returns a list

  • hands-on, advanced: decide what kind of result your function should return, and add this element]

Setting Guardrails

  • Documentation
  • Typing
  • Testing inputs and returning errors
  • Writing tests for your functions

[* hands-on, beginner: given an example function, write your own docstring

  • hands-on, beginner: given an example function, write your own test
  • hands-on, advanced: add a docstring to your function
  • hands-on, advanced: add a chunk of code to your function to test an attribute of the input]

Combining Functions

  • Multiple functions to get to the end result
    Conclusions

More Info: https://nicercode.github.io/guides/functions/

=====
TIME

https://www.timeanddate.com/worldclock/fixedtime.html?msg=RLC+%26+RLEL%3A+Writing+R+Functions&iso=20210226T13&p1=77&ah=2

Members are also interested in