R Programming Basics | Microsoft Tutorial

Coursera · Beginner ·🛠️ AI Tools & Apps ·8mo ago

Key Takeaways

Writes and executes basic R code using Visual Studio Code

Full Transcript

Hello and welcome to this screencast on basic R code. Today we're going to dive into the essentials of scripting in R using Visual Studio Code as our development environment. Whether you're new to programming or just new to R, this session will help you get comfortable with the basics. Let's start by understanding the structure of an R script. Think of a script as a set of instructions that you give to the computer to perform specific tasks. In R. These tasks can range from simple calculations to complex data analysis. First, let's write a simple calculation. In your R script, type the following. Let's type in result followed by the assignment operator 5 + 3. Then we will print result. Finally, let's add some commenting. In this case, we'll add the following comment. We'll use hashtag or pound to start our comment and type in this is a simple addition in R. Now let's run this here in this problem. We're adding five and three and storing the result in a variable called result. Then we're printing it out. Notice that using the assignment operator in this case the less than minus sign that looks like an error arrow which is unique to R. R is case sensitive. So be mindful of how you name your variables. Also, comments in R are written using the hashtag symbol. As you can see here, it also colors it green. Comments are crucial for making your code understandable to others and to your future self. Now, to execute this code in VS Code, you can simply highlight the lines you want to run and press control enter or command enter depending of whether you're Windows or Mac. This will send the code to the R console and execute it. Let's try it again. Highlight it. Command enter. Now you should see the number eight printed in the console. As you can see, this is a result of our addition. Interpreting output is a very key skill here. The console output confirms that our code executed successfully and returned the expected value. If you encounter errors, check your syntax and ensure all of all the variables are correctly defined. Okay, now let's add a little bit more complexity. Let's clean our environment. Start by writing a function that multiplies two numbers. Let's type in multiply and then we'll autocomplete with the function x and y where we will ask to return the multiplication of x and y characterized by xar y. Now let's do using the function where we will define a variable called product assign it multiply. In this case let's do four and five. All right. Finally, let's print our product variable. So, press this. All right. Here we have defined the function multiply that takes two arguments and returns a product. We then call this function with the numbers four and five. Now, let's run this code the same way as before by highlighting it and doing command enter. You could see that 20 is printed in the console which is obviously the product of four and five. And there you have it. You've written and executed basic R code including a simple function. Remember, practice is key to becoming proficient in R. Keep experimenting with different operations and functions to deepen your understanding. Thank you for joining the screencast and happy coding.

Original Description

Start your R programming journey with this beginner-friendly tutorial. Learn to write and execute basic R code using Visual Studio Code, with step-by-step guidance from Microsoft's R Programming Certificate program. 🕐 Timestamps: 0:00 - Introduction 0:23 - Understanding R Scripts 0:43 - Writing Your First Calculation 1:05 - Adding Comments 2:01 - Executing Code in VS Code 2:46 - Basic Function Creation 3:38 - Running Functions 4:13 - Conclusion & Next Steps 🎓 This is a course preview of the *Microsoft R Programming for Everyone Professional Certificate* on Coursera. With the complete program, you'll: • Learn to write efficient R code • Collaborate through GitHub • Analyze complex datasets • Use AI tools to enhance productivity • No prior programming experience needed • Build a professional portfolio of hands-on projects using real datasets in a Microsoft development environment Enroll now to access the complete 5-course program 👇 https://bit.ly/43VewzM #RProgramming #DataScience #Microsoft
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Coursera · Coursera · 0 of 60

← Previous Next →
1 Principles of Obesity Economics with Professor Kevin Frick
Principles of Obesity Economics with Professor Kevin Frick
Coursera
2 Introduction to the U.S. Food System: Perspectives from Public Health by John Hopkins University
Introduction to the U.S. Food System: Perspectives from Public Health by John Hopkins University
Coursera
3 E-learning and Digital Cultures
E-learning and Digital Cultures
Coursera
4 Equine Nutrition with Jo-Anne Murray
Equine Nutrition with Jo-Anne Murray
Coursera
5 Coursera Meetup BBQ
Coursera Meetup BBQ
Coursera
6 Contraception: Choices, Culture and Consequences with Jerusalem Makonnen
Contraception: Choices, Culture and Consequences with Jerusalem Makonnen
Coursera
7 Nutrition for Health Promotion and Disease Prevention with Katie Clark
Nutrition for Health Promotion and Disease Prevention with Katie Clark
Coursera
8 Information Security and Risk Management in Context with Dr. Barbara Endicott-Popovsky
Information Security and Risk Management in Context with Dr. Barbara Endicott-Popovsky
Coursera
9 Contraception: Choices, Culture and Consequences with Jerusalem Makonnen
Contraception: Choices, Culture and Consequences with Jerusalem Makonnen
Coursera
10 Writing in the Sciences with Kristin Sainani
Writing in the Sciences with Kristin Sainani
Coursera
11 Economic Issues, Food, and You with Jennifer Clark
Economic Issues, Food, and You with Jennifer Clark
Coursera
12 Leading Strategic Innovation and Creativity in Organizations with David A. Owens, PhD
Leading Strategic Innovation and Creativity in Organizations with David A. Owens, PhD
Coursera
13 Useful Genetics with Professor Rosie Redfield
Useful Genetics with Professor Rosie Redfield
Coursera
14 A History of the World since 1300!!!! with Jeremy Adelman
A History of the World since 1300!!!! with Jeremy Adelman
Coursera
15 Microeconomics  with Richard McKenzie
Microeconomics with Richard McKenzie
Coursera
16 Discrete Optimization with Professor Pascal Van Hentenryck
Discrete Optimization with Professor Pascal Van Hentenryck
Coursera
17 Leading Strategic Innovation and Creativity in Organizations with David A. Owens, PhD
Leading Strategic Innovation and Creativity in Organizations with David A. Owens, PhD
Coursera
18 Science from Superheroes to Global Warming with Michael Dennin
Science from Superheroes to Global Warming with Michael Dennin
Coursera
19 Introduction to Digital Sound Design with Steve Everett by Emory University
Introduction to Digital Sound Design with Steve Everett by Emory University
Coursera
20 Women and the Civil Rights Movement with Dr. Elsa Barkley Brown
Women and the Civil Rights Movement with Dr. Elsa Barkley Brown
Coursera
21 Galaxies and Cosmology with S. George Djorgovski
Galaxies and Cosmology with S. George Djorgovski
Coursera
22 Science, Technology, and Society in China I, II, and III: Basic Concepts with Naubahar Sharif
Science, Technology, and Society in China I, II, and III: Basic Concepts with Naubahar Sharif
Coursera
23 Introduction to Pharmacy with Kenneth M. Hale, R.Ph., Ph.D.
Introduction to Pharmacy with Kenneth M. Hale, R.Ph., Ph.D.
Coursera
24 AIDS with Kimberley Sessions Hagen, EdD
AIDS with Kimberley Sessions Hagen, EdD
Coursera
25 Health Informatics in the Cloud with Mark Braunstein
Health Informatics in the Cloud with Mark Braunstein
Coursera
26 Songwriting with Pat Pattison by Berklee College of Music
Songwriting with Pat Pattison by Berklee College of Music
Coursera
27 Software Defined Networking with Dr. Nick Feamster
Software Defined Networking with Dr. Nick Feamster
Coursera
28 Epigenetic Control of Gene Expression with Dr Marnie Blewitt
Epigenetic Control of Gene Expression with Dr Marnie Blewitt
Coursera
29 Guitar for Beginners - Introduction to Guitar with Thaddeus Hogarth by Berklee College of Music
Guitar for Beginners - Introduction to Guitar with Thaddeus Hogarth by Berklee College of Music
Coursera
30 Organizational Analysis with Daniel McFarland
Organizational Analysis with Daniel McFarland
Coursera
31 Scientific Computing with J. Nathan Kutz
Scientific Computing with J. Nathan Kutz
Coursera
32 Jazz Improvisation - Introduction to Improvisation with Gary Burton by Berklee College of Music
Jazz Improvisation - Introduction to Improvisation with Gary Burton by Berklee College of Music
Coursera
33 Principles of Economics for Scientists with Antonio Rangel
Principles of Economics for Scientists with Antonio Rangel
Coursera
34 Introduction to Music Production with Loudon Stearns by Berklee College of Music
Introduction to Music Production with Loudon Stearns by Berklee College of Music
Coursera
35 Principles of Public Health with Zuzana Bic
Principles of Public Health with Zuzana Bic
Coursera
36 The Science of Gastronomy with King Chow, Lam Lung Yeung by HKUST
The Science of Gastronomy with King Chow, Lam Lung Yeung by HKUST
Coursera
37 The Language of Hollywood: Storytelling, Sound, and Color with Scott Higgins by Wesleyan University
The Language of Hollywood: Storytelling, Sound, and Color with Scott Higgins by Wesleyan University
Coursera
38 Nutrition and Physical Activity for Health with John M. Jakicic, Ph.D., and Amy D. Rickman,...
Nutrition and Physical Activity for Health with John M. Jakicic, Ph.D., and Amy D. Rickman,...
Coursera
39 Nutrition, Health, and Lifestyle: Issues and Insights with Jamie Pope, MS, RD, L
Nutrition, Health, and Lifestyle: Issues and Insights with Jamie Pope, MS, RD, L
Coursera
40 Survey of Music Technology with Jason Freeman by Georgia Institute of Technology
Survey of Music Technology with Jason Freeman by Georgia Institute of Technology
Coursera
41 Exercise Physiology: Understanding the Athlete Within with Mark Hargreaves
Exercise Physiology: Understanding the Athlete Within with Mark Hargreaves
Coursera
42 Canine Theriogenology for Dog Enthusiasts with Margaret V. Root
Canine Theriogenology for Dog Enthusiasts with Margaret V. Root
Coursera
43 Web Intelligence and Big Data with Gautam Shroff
Web Intelligence and Big Data with Gautam Shroff
Coursera
44 Critical Perspectives on Management with  Rolf  Strom-Olsen
Critical Perspectives on Management with Rolf Strom-Olsen
Coursera
45 El ABC  del emprendimiento esbelto  with Sergio  Ortiz Valdes
El ABC del emprendimiento esbelto with Sergio Ortiz Valdes
Coursera
46 Interprofessional Healthcare Informatics with Karen  Monsen
Interprofessional Healthcare Informatics with Karen Monsen
Coursera
47 Creativity, Innovation, and Change with Jack V. Matson, Darrell Velegol and Kath
Creativity, Innovation, and Change with Jack V. Matson, Darrell Velegol and Kath
Coursera
48 Innovacion educativa con recursos abiertos with Maria Soledad Ramirez Montoya an
Innovacion educativa con recursos abiertos with Maria Soledad Ramirez Montoya an
Coursera
49 Inspiring Leadership through Emotional Intelligence with Richard Boyatzis
Inspiring Leadership through Emotional Intelligence with Richard Boyatzis
Coursera
50 Matematicas y movimiento with
Matematicas y movimiento with
Coursera
51 Sustainability of Food Systems: A Global Life Cycle Perspective with Jason Hill
Sustainability of Food Systems: A Global Life Cycle Perspective with Jason Hill
Coursera
52 Latin American Culture with Enrique Tames
Latin American Culture with Enrique Tames
Coursera
53 Latin American Culture' with undefined
Latin American Culture' with undefined
Coursera
54 Computer Security with Dan Boneh
Computer Security with Dan Boneh
Coursera
55 Introduction to Art: Concepts & Techniques
Introduction to Art: Concepts & Techniques
Coursera
56 Programmed cell death
Programmed cell death
Coursera
57 El ABC  del emprendimiento esbelto
El ABC del emprendimiento esbelto
Coursera
58 Understanding economic policymaking
Understanding economic policymaking
Coursera
59 History of Rock, Part 1 by University of Rochester
History of Rock, Part 1 by University of Rochester
Coursera
60 Pensamiento Cientifico
Pensamiento Cientifico
Coursera

Related Reads

📰
The new ChatGPT macOS app redesign has made basic navigation so much worse
Learn how to adapt to the new ChatGPT macOS app redesign and optimize your workflow despite the changes to navigation
Reddit r/artificial
📰
Three Token-2022 Mints in One Week: Fees, Yield, and Soulbound
Learn how to build three different Token-2022 mints on Solana devnet in one week, including fee-bearing, interest-accruing, and soulbound tokens
Dev.to · atharv shukla
📰
Maximize Google Workspace AI Power: Safeguard Data and Boost Performance in 2026
Maximize Google Workspace AI power by safeguarding data and boosting performance to stay ahead in 2026
Dev.to AI
📰
What is Gemini Spark, and what can it actually do for you?
Gemini Spark integrates AI into daily Google apps to enhance productivity, learn how to leverage it
TechCabal

Chapters (8)

Introduction
0:23 Understanding R Scripts
0:43 Writing Your First Calculation
1:05 Adding Comments
2:01 Executing Code in VS Code
2:46 Basic Function Creation
3:38 Running Functions
4:13 Conclusion & Next Steps
Up next
Trigger Ollama from Anywhere
Matt Williams
Watch →