Back to Browse

Vectorisation and creating custom functions in R

75 views
Mar 21, 2022
59:20

Kevin Bairos-Novak presents Vectorisation in R to speed up code execution and Creating custom functions in R --CHAT-- 00:05:59 Lauriane Baraf: Pretty familiar with it 00:06:25 Ashton Kelly: Somewhat familiar 00:06:41 Tom Swan: Quite familiar 00:06:50 Maxine: I know nothing... 00:07:05 Yomani Sarathkumara: Somewhat familiar 00:20:45 Maxine: Warning message: package ‘microbenchmark’ was built under R version 4.1.2 00:21:02 Maxine: thank you 00:25:48 Lauriane Baraf: I like this 00:25:56 Natalia Andrade Rodriguez: Super cool ! 00:27:30 Ashton Kelly: Good here 00:27:33 Maxine: Yaassss! 00:27:33 Tom Swan: tes 00:27:46 Natalia Andrade Rodriguez: Yes! 00:31:27 Lauriane Baraf: Mutate 00:34:02 Ryley Dorney: gapminder$popMil - gapminder$pop / 1e6 00:37:08 Lauriane Baraf: Year x, pop y 00:37:37 Lauriane Baraf: Capital letter 00:37:42 Ryley Dorney: Case sensitivity 00:42:30 Natalia Andrade Rodriguez: YES! 00:43:00 Legana Fingerhut: Whooohooo functions! 💃 00:43:06 Jacob Westaway: terrible name 00:43:29 Natalia Andrade Rodriguez: You can call it Jacob Jacob haha 00:43:38 Jacob Westaway: way ahead of you 00:43:59 Legana Fingerhut: Usually you want to name your function that reflects what it actually does 00:49:17 Kevin Bairos-Novak [JCU]: my_function - function (arguments) { # performing an action, e.g. arguments + 3 out - arguments + 3 # return an object as output return(out) } my_function(5) 00:49:31 Ryley Dorney: Will it work on a vector as an argument? 00:52:03 Natalia Andrade Rodriguez: Haha ooh 00:52:04 Lauriane Baraf: FToC 00:52:22 Legana Fingerhut: convert_celcius_to_fahrenheit 00:53:11 Ryley Dorney: Farenheit_value 00:53:48 Ashton Kelly: 32F is 0C 00:54:04 Jacob Westaway: Americans... 00:54:49 Ryley Dorney: Celcius - (Farenheitvalue - 32) * 5/9 00:55:14 Ryley Dorney: woops, capital f 00:55:31 Kevin Erickson: Freedom units! 00:56:01 Ryley Dorney: return the object 00:56:07 Legana Fingerhut: celsius_value to return the object 00:56:50 Kevin Erickson: 180 degrees between freezing and boiling of pure water at sea level. IDK about the 32 degree offset though. 00:57:46 Kevin Erickson: -40 00:57:58 Legana Fingerhut: Its easier if you do it in Markdown and write your function in a separate code chunk … Then you can just run the code chunk that contains your function 01:00:06 Legana Fingerhut: You’re missing the ! There, Kevin 01:03:49 Kevin Erickson: Yes! 01:03:54 Kevin Erickson: Or is that no? 01:04:10 Legana Fingerhut: !No 01:04:33 Kevin Erickson: !RisFun 01:04:46 Ryley Dorney: Thank you! You made this easy to follow :) 01:05:06 Legana Fingerhut: lol 01:05:58 Kevin Erickson: I’ve needed a DMS to decimal degree converter like this in the past. 01:06:34 Kevin Erickson: IS there a calendar event for these? 01:06:52 Lorenzo Bertola: Calendar’s for ale’s event coming out today 01:07:00 Lorenzo Bertola: needed to finalise rooms and times 01:07:23 Lorenzo Bertola: I’ll be there 01:07:48 Maxine: Thank you so much for today! 01:07:48 Lauriane Baraf: Thank you, that was fun! 01:07:49 Kevin Erickson: Thanks Kevin! 01:07:54 Ashton Kelly: Thank you! 01:08:03 Kathleen Vowles: thank you 01:09:06 Lorenzo Bertola: Good job team

Download

0 formats

No download links available.

Vectorisation and creating custom functions in R | NatokHD