R Markdown TUTORIAL | A powerful tool for LEARNING R (IN 45 MINUTES)
Vložit
- čas přidán 8. 05. 2024
- Walkthrough tutorial on how to use R Markdown and how it can help you learn R!
Timestamps:
0:00 Intro to this Video and Prerequisites
2:18 Getting Started With RMarkdown
6:08 Why Use RMarkdown?
7:59 Working With Text (Headings, Links, Bold)
15:39 Inserting Code
22:42 Displaying R Code Inline (In the Text)
25:49 Tips for Running Code Chunks
28:19 Changing the Appearance of Your Document
31:28 Adding a Table of Contents
33:06 Concluding Your Document
35:38 How to Use RMarkdown to Learn R
40:39 Learning from Errors
42:58 Table of Contents Extras
44:33 Closing Remarks
Link to my Basics of R (for Ecologists) course: coaching.rforecology.com/the-...
PREREQUISITES: Watch these three first three lessons of my course to get the very basics:
Lesson 1: Installing R and RStudio: • R for Ecologists (Less...
Lesson 2: Start using R and RStudio: • R for Ecologists (Less...
Lesson 3: Important RStudio tweaks: • R for Ecologists (Less...
Link to blog post on using R Projects: www.rforecology.com/post/orga...
Excellent, the most productive 45 minutes of today. You did it all in one take, nice!
Thank you! I'm so glad you enjoyed the video. :)
Best R Markdown TUTORIAL, simple and very effective, thank you a million!
Hi Joanne, I’m glad I could be of help! Thanks so much for your encouragement. If you’re interested, I’ve made an entire course similar to this style of this video over on my website (www.rforecology.com). It covers the basics of R for ecologists, ranging from data visualization to advanced data wrangling. You can also watch the first four lectures in the course for free on this CZcams channel!
Please keep up the tutorials
Thanks for not over complicating, appreciate the help
Will do! Thank you for the kind words.
Really good video. I read some documentation of Markdown, but this was easier to follow and the suggestions were a gift. Thanks for the great content!
I'm glad to hear that I could help! Thanks for the support.
5 minutes into this video and it was more than worth it. Thank you so much
Awesome, I'm so glad you enjoyed the video!
Perfect intro for R Markdown. Thank you!
No problem, it's my pleasure! Thank you for the kind words and supporting the channel.
I am really glad and happy to watch your tutorial. I heard about Rmarkdown recently I wish that I heard about it before it is the best way to learn and organize your codes at the same time
It's a great tool to have! Just note that sometimes when using R-Markdown, some users have reported the code runs slower than if it was in an R script when there are hundreds of lines. Not when knitting, but trying to run their entire .rmd in R-Studio. It shouldn't be an issue in most cases.
Oh my God, it was really great for a beginner. I did`nt saw such a compact tutorial. Very well done boss
Thank you so much! Always appreciate the support.
Excellent video.
Well explained.
Arguably the best RMarkdown video on youtube.
Thank you for the kind words and support! I'm glad you enjoyed the video.
and my very first one
This was really helpful intro 👏 Thanks for sharing. Cheers.
I'm so glad you found this helpful. Thanks for the encouragement and support!
Useful, clear, well produced lesson. thanks.
Thank you for the kind words. I'm glad you enjoyed it!
Really cool video! Thanks for making the basics of R Markdown so easy to grasp :)
It's my pleasure! I'm glad you liked the video, and I appreciate the support.
Clear and helpful! Thank you so so much!
Absolutely, it's my pleasure!
Wow, this is a very helpful way to learn R. I really enjoyed it.
So glad to hear! Thanks for the feedback!
Thank you for this video. I am going to add a table of contents to my future work
Glad it was helpful!
that tutorial is not exactly what I am looking for, but I have viewed this 45min video through. Authentically informative!
Hey, that's still great to hear! If I may ask, what were you looking for? Maybe it's something that I can consider making a video about in the future.
Thank you!! Im having a job interview for Rmarkdown and you saved my life
Haha, glad I could help! Thanks for watching.
My biostatistician (for my thesis) asked me to try Markdown and I had to look for a tutorial. Yours was easy to follow and fantastic! Thank you. :)
Awesome, I'm glad I could help! Thank you for the support.
Wonderful explanation. Thank you!
No problem! Thank you for the kind words of support.
Great Video! Thank you!!!
This video is just awesome, thank you so much!
It's my pleasure! So glad you enjoyed the video.
Excellent tutorial! Thanks!
Thank you for the kind words. I'm glad you enjoyed it!
Nice man! Really appreciate the effort!
It's my pleasure, I appreciate the support!
Very efficient and concise...
Thank you
Awesome, I'm glad you liked it! Thanks for supporting the channel.
Really a very helpful video. Thank you so much
It's my pleasure! Thank you for supporting the channel!
I am taking Google Data Analytics course in Coursera and this video is really helpful and explain much clearer than in the course. Thanks for the teaching!
No problem! I'm glad I could help.
This was a good referesher coruse for me. Thank you.
No problem, that's great to hear! Appreciate you supporting the channel.
Thanks a lot. Really effective.
No problem, it's my pleasure! Thanks for supporting the channel.
Superb Video !! Thank You 🙂
🙏No problem, thank you for the kind words!
insightful Thank you
Of course, it's my pleasure!
Thanks, this helped a lot.
So glad to hear! Thank you for the support!
Thank you very much it was very helpful
Thank you so much for your encouragement! I am glad to hear that you enjoyed the video.
Thanks for this ---- very useful!
That's great to hear! Appreciate the support.
I have an assignment deadline in a day. I skipped all the R Markdown sessions, Now seeing his videos with the thought of Binge Watching.
Well, I hope this video helps you complete it before the deadline. Fingers crossed!
Great video. Thank you very much
Glad to hear it! Thanks for the support.
AMAZING!! Thank you!
No problem, it's my pleasure! I don't think many people realize how useful R Markdown can be until they've seen someone else use it. Thanks for supporting my content.
This is one of the best tutorials! Thank you so much, I thought R Markdown was something really difficult that I would take days to learn but 45 mins is all it took! Thanks for your awesome work. One question though: Is there a way to suppress console output? and only print like the most relevant things like the plots or final output of an inferential stats analysis?
So glad to hear you enjoyed the tutorial! Yes, R Markdown isn't such a scary thing to learn!! Yes, there is a way to suppress console output. Basically, you can add different things to the {r} section that denotes the start of the code chunk. For example, {r, results = 'hide'} will hide the console output. You can check out all the different things you can add here: bookdown.org/yihui/rmarkdown-cookbook/hide-one.html
@@RforEcology thanks so much 😊 !
@@nilosmitabanerjee2492 My pleasure!
You Sir are a legend
😎 Thank you very much. I appreciate you supporting the channel!
This is FAAAAAN........TASTIC! Thank you!
I'm so glad you enjoyed it!
@@RforEcology I did to be fair. Pls how can i give access to this markdown to people who visit my portfolio website? Can one generate a link to use on the website?
@@folashadeolaitan6222 That’s a good question. It depends on how you’re hosting your website and, if it’s a service, what the website allows. If you knit the markdown file as an HTML output format, some website hosting services allow you to upload these as a static website. Here’s a link with more information: bookdown.org/yihui/rmarkdown-cookbook/html-share.html
Another method would be to knit the markdown file as a PDF and upload it to your portfolio as a viewable document. Hope this helps!
@@RforEcology That’s great, thank you for your response. I will try out both suggestions
@@folashadeolaitan6222 Glad I could help.
Thank you very much
Of course, it's my pleasure! Thanks for supporting the channel.
This was an awesome video.
But, I didn't understand what the point of creating an R project was.
It sounds like a very interesting concept. If this was the subject of a future video, I would definitely watch!
Hi Pete, awesome inquiry. The point of creating an R project is to properly arrange and organize all files that are related to a specific project you're working on. Basically, all of your related files (scripts, data, output, etc) are packaged into a folder that is easily shared with others. You can check out our blog post here to read more about it: www.rforecology.com/post/organizing-your-r-studio-projects/
Perfect...Thank you soo much :))))
My pleasure! I'm so glad you enjoyed the video.
@@RforEcology It is wonderful. Now I am applying it for my master thesis :))) Thanks to you :)
@@mahmoudmoustafamohammed5896 That's awesome!! Best of luck with the master's thesis :)
Thank you for this tutorial! Made my life so much easier. The only thing I am having trouble with is using the Pipe operator. I can get the output in the console, but I keep getting the error "could not find function "%>%". I know I have the right packages installed as well . . .
So good to hear that you like the tutorial! Hm...so you're totally sure you have run either of the following lines of code?:
library(tidyverse)
library(magrittr)
The pipe operator comes with the magrittr package, which is folded into the tidyverse. If you're still having trouble, you can email us with a screenshot or a code snippet at luka@rforecology.com and we can help you troubleshoot further.
10/10 Thank You....
It's my pleasure! I'm glad you enjoyed the video and appreciate your support.
Thank you so much!!!!!!!!!!!!!!!!!!!!
No problem! Always appreciate the support.
amazing!
Thank you! So happy that you liked it.
Opening that chunk was hard for me, thanks for helping🙏
Hey, but at least you figured it out! Nice work, and I appreciate the support.
Hi Luka, tank you for the informative tutorial. Would you please advise how to get the split screen, showing both scripting window and the Rmarkdowm output side by side.
Glad you liked it! To have the knitted document in the viewer window instead of a pop-out, you go to Tools -> Global Options -> R Markdown. Then there is a line stating "Show output preview in: ". In the drop-down menu next to it, click "Viewer Pane" and "Apply" in the bottom right and you're all set!
"Tilde" pronunciation really got me rollin over the floor =)
Haha, it's certainly unique.
@@RforEcology True
Thank you for the video!
How do you set up a CRAN mirror in R Markdown. Markdown doesn't already come with CRAN installed.
Glad you enjoyed it!
To set up a CRAN mirror, you can either:
A) Go to the "Tools" in your top menu bar, then "Global Options", and then click "Packages" on the left column. From here you'll be able to change your CRAN repository.
B) Run the function "chooseCRANmirror()". It will print a list of CRAN mirrors to choose from and you simply type the number of the one you'd like!
Thank you Luka for this great video! what should I do to see the result in the viewer window as you did?
It’s my pleasure. To have the knitted document in the viewer window instead of a pop-out, you go to Tools -> Global Options -> R Markdown. Then there is a line stating "Show output preview in: ". In the drop-down menu next to it, click "Viewer Pane" and "Apply" in the bottom right and you're all set!
@@RforEcology thanks! It works.
@@avshalomkoren9104 Super! Now you're all set to make some terrific Markdowns!
` this is a grave accent (the one used to insert the R code inside R Markdown as in ```{r})
' this is a straight apostrophe or a straight single quotation mark
‘ this is a curly opening single quote
’ this is a curly closing single quote or a curly apostrophe
Awesome! Thank you for the quick reminder.
Super well done! Could you add the link to the cheat-sheet? :)
Thank you so much! Always appreciate the support.
The R Markdown cheat sheet can be found here: github.com/rstudio/cheatsheets/raw/main/rmarkdown-2.0.pdf
Hi, thanks for the detailed video. Could you make a similar video on how to sync your RMD to GitHub? I use a Mac and it’s almost impossible for me to understand how to do that. Thanks❤
Hey there, it's my pleasure. It's definitely a topic I have considered making a video on, but at the moment, I do not have exact plans for it yet. If you're looking for a more immediate solution, this guide by Jenny Bryan and his team walks you through how to build a repository, link it to R-Studio, and start pushing all of your revisions to GitHub: happygitwithr.com/rstudio-git-github.html
16:20 that character is called a backtick, backquote, grave, or grave accent
Thanks for the tip! Helpful to know the names of things :)
Thanks for the video. But where is the link for the Rmasrkdown Cheetsheet?
Glad you liked it! The latest R Markdown cheat sheet can be found here: raw.githubusercontent.com/rstudio/cheatsheets/main/rmarkdown.pdf
super man
Thank you, I appreciate the support!
I have been set a task to use R markdown. I have been asked to hide all my code in the HTML - any idea of how to do this?
That's a great question! You can hide your code in the final document/webpage and still show your result by putting "echo=FALSE" in the chunk header. It would look something like this: " ```{r, echo=FLASE} "
Do you know how to get Bash chunks to work on Rmarkdown? I keep getting this error: "'bash' is not recognized as an internal or external command,
operable program or batch file."
I have bash installed on my computer, but I don't know how to get R to recognize it.
shoot me an email at luka@rforecology.com
Which R theme are you using in your R Studio?
Hey there! It's one of the built-in R themes called Solarized Dark.
How can you use dataset in environment and get it summary
Hi Tejas, thanks for your question! Once you load a data set into your R environment, you can just use the function summary(your_data) to get basic statistics (mean, median, max) for each of your data's columns.
Alternatively, you can use the function str(your_data), which describes the structure of your data frame.
I hope I understood your inquiry correctly; hope this helps! Let me know if you have any other questions.
I'm analyzing a data file in r so i tried putting some code in rmarkdown and it keeps giving me an error of object x not found.
Hey there, that error usually comes from trying to call/reference an object that was not properly defined. This could be due to the names not being the same, accidentally not running the line where you define the variable, or some other less common issues.
One way you can check if the object you are trying to call is in your environment is by running "ls()" in your console. This will list all the objects currently saved in your environment to see if maybe it's under a different name (capitalization and spacing matters) or possibly wasn't saved.
@@RforEcology thanks very much
@@ameenabdulbarr8342 No problem, glad I could help. Appreciate you watching the videos!
How can i show only my r - code output on word_document.
That's a great question. You can knit your code into a Word document if you click the down-pointing arrow next to the "Knit" button and click "Knit to Word".
👍👍👍👍
Thanks for the support!
16:00
After knitting it to pdf it appears to downloaded tinytex i've installed and executed it but still it appears to download it first...any solution plz
Huh, that's interesting. A few questions so I can try and help figure this out: 1) Are you still able to knit a PDF, or does it not actually output a file? 2) Have you installed both tinytex and LaTeX and are they both updated to the latest versions? 3) Are you getting any error messages when you try to knit it?
@@RforEcology Thanks for your reply.. I've successfully knitted my file as the error was asking to restart r or reinstall the package after doing reinstallation it is working well..
@@ayeshazafar5610 Oh good! I'm glad you were able to work it out. Happy coding!
Install packages in R
Hey there! I actually cover installing and loading packages in my video "Tutorial on 80% of everything you will EVER need to know in R (for ecology)", which you can find here: czcams.com/video/dQe3Z7hRG1s/video.html
8:00
The weird quote is called a backquote, ot some folk call it a backtic. Just fyi😀
Thanks for the tip! It's always helpful to know the name of things, haha.
@@RforEcology Yep, makes it easier to talk about stuff when you have the words.
25:32 haha