I purchased a freakin course in R and I had trouble understanding this one topic. Well, I found your topic here on youtube and it was well explained in a 12 minute video. Props to you man..... Thanks a lot
@weecology2 жыл бұрын
Thanks! Functions are definitely tricky and it's taken me years of iteration to get to that 12 minutes so I'm very glad that it's useful.
@jacksfacts202 жыл бұрын
First I wanna say thank you for this very informative video, 2nd, As a small youtuber myself, the fact that you did a lot of this in one take is impressive and tough to do. From personal experience, you can make it a lot easier on yourself by breaking up what your saying into small chunks that you can cut together. That why you don't have to worry about awkward pauses as much. People don't mind cuts of you speaking if they're in logical places like the end of sentences and such.
@epijournal84234 жыл бұрын
A very clear video ! There are few tutorial on function building on KZbin. Going to go through the others now :) Cheers.
@GurpreetSingh-uj6bq2 жыл бұрын
One of The best videos I ever watched on functions
@weecology2 жыл бұрын
Thanks!
@rayraystinz2 жыл бұрын
this was incredibly clear, helpful and I appreciate the format! nice to see a human face (instead of just the typical voiceovers)
@weecology2 жыл бұрын
So glad it was useful!
@donniemarshall2531 Жыл бұрын
Thank You! This helped my learning curve tremendously. You are an awsome teacher! and singer!
@weecology Жыл бұрын
Thanks! So glad it’s helpful!
@aayushimittal52703 жыл бұрын
Awesome video... Thanks to you I finally know the meaning of curly brackets
@weecology3 жыл бұрын
Soo glad it was helpful!
@KameshwarChoppella Жыл бұрын
Very well explained. I'm likely coming back to this channel. Subbed
@weecology Жыл бұрын
Thanks!
@jaclynjuarez92893 жыл бұрын
Thank you for this video. It really helped with my studies. Your explanation made it easy to understand functions in r
@weecology3 жыл бұрын
Awesome! Very glad it was helpful.
@shotpana2 жыл бұрын
Thank you! You are an amazing professor!
@weecology2 жыл бұрын
So glad it's helpful!
@timmytesla96552 жыл бұрын
This is super clear. Thank you!
@weecology2 жыл бұрын
You're welcome!
@quantowen11242 жыл бұрын
This was extremely helpful! Love it!
@weecology2 жыл бұрын
So glad it was useful!
@Skyking8383 Жыл бұрын
How would you create a function in order to create a time series plot? I am not sure what information you would put
@tatianam76572 жыл бұрын
Excellent!
@gabrielamendezospino64152 жыл бұрын
Hi, I get the error object 'lenght' not found when trying to call the function, I image it's because there should be a dataset with the variable of that name, right?
@weecology2 жыл бұрын
Looks like maybe you just have a typo. The way I wrote it It's 'length' not 'lenght'. All that actually matters is that it is the same in the parentheses and in the body of the function.
@mitch61513 ай бұрын
Clear! Great!
@weecology2 ай бұрын
Thanks!
@willatkinson1413 жыл бұрын
How would you go about returning more than one calculation at a time for the same function? Great video.
@weecology3 жыл бұрын
That's a great question. Typically if you want to return more than one value you pass those values back in a single object that can store multiple values. Most commonly this would be a list, but it could also be a vector or something else. In the function you create a list that holds each of the things you want to return and then return the list at the end.
@da8804ss2 жыл бұрын
great explanation
@Samyak_Patil2 жыл бұрын
Thank you so much. You made it super easy.
@weecology2 жыл бұрын
Glad it was helpful!
@aniladeepu89992 жыл бұрын
sir, how to integrate the following function in r using limits -Infinity to x. f1
@karanthakker26722 жыл бұрын
This is a fantastic tutorial! Keep it up, you've earned a sub :)
@weecology2 жыл бұрын
Thanks!
@multitaskprueba12 жыл бұрын
You are a genius! Thank you!
@weecology2 жыл бұрын
Thanks!
@redrosin992 жыл бұрын
Your explanation is very good however I would like to know: 1. Which editor are you using? 2. Where in memory should I save the function (as a separate R file) and how should I let R know about its existence (does it have to be loaded as a package or do I have a workspace?)
@weecology2 жыл бұрын
The video uses RStudio, which is the most common development environment for R. For small projects I recommend just keeping the function in the same R file as the rest of your code. Just put all of the functions at the top of the code (after loading any packages but before any code that isn't in functions) and then all the functions in the code. If it's a bigger project you can put one or more functions into one or more separate R files. To let R know about them at the top of your code you run `source("/path/to/yourfile.R")`. This will run all of the code in that file and so if that file is just functions it will define all of those functions so that you can use them.
@redrosin992 жыл бұрын
@@weecology thank you for your answer and for your great videos!!
@weecology2 жыл бұрын
@@redrosin99 You're welcome!
@rishabhkansal33092 жыл бұрын
much useful
@andreasioannides38682 жыл бұрын
Hi sir im a student and i have a question that tells me to construct a function with two arguments A and u that return only the non zero entries of a vector E. Vector E has length 25000 and is defined as E=max(A-u, 0) i have already build a function for vector A in a previous part. i desperately need help thank you
@gsalem73513 жыл бұрын
Thank you
@taiwolawal96872 жыл бұрын
this was super helpful, what if i want the function to take input from a sequence say example output of test
@weecology2 жыл бұрын
You can pass any object to a function, so you can certainly pass test as an argument in this case. Then inside the function you treat test however you would outside of the function. Any operations that work on sequences can be used inside the function.
@asadkhanbb Жыл бұрын
❣️❣️❣️
@ckeong90123 жыл бұрын
clear. tq sir
@bismaarshad28010 ай бұрын
OMG! THANKSSSS MANNNN!
@weecology10 ай бұрын
You’re welcome!
@auracristinareynavarro25233 жыл бұрын
great!
@carlyap59433 жыл бұрын
AYOS YAN PRE PALIKE
@divyabadlia58304 ай бұрын
Whenever I try to change line after using braces to write function body I can't seem to do it I can't seem to separate those braces can anyone help me with this
@weecology2 ай бұрын
Is this in RStudio?
@krushnachChandra3 жыл бұрын
helpful video you got new sub
@Oluwaseun_Adeyemi2 жыл бұрын
how can I write a function to calculate kurtosis?
@weecology2 жыл бұрын
The input value to your function would be a vector of the values that you want to use for the kurtosis calculation. You would then calculate the kurtosis for that vector, which is something like mean((values - mean(values)) / sqrt(var(values))) (I haven't checked this so you should make sure it matches en.wikipedia.org/wiki/Kurtosis and works. This functionality is also available in a bunch of packages including the moments package cran.r-project.org/web/packages/moments/index.html
@theunitydev54183 жыл бұрын
As someone that knows how to code this hurts to watch and learn and its most definetly not your fault but Rs. Who came up with the idea of not having to define the type of variable you are using shit get confusing fast
@richardsmith93992 жыл бұрын
Good talk, but you a goofy lookin dude. Thanks man!