Skip to main content

Getting Started with R Programming

The Beginner’s Guide to R Programming.

I'm very excited to start R Programming and I hope you are too. This is the second course in the Data Science Specialization and it focuses on the nuts and bolts of using R as a programming language.

The recommended background for this course is the course The Data Scientist's Toolbox. It is possible to take this class concurrently with that class but you may have to read ahead in the prerequisite class to get the relevant background for this class. For a complete set of course dependencies in the Data Science Specialization please see the course dependency chart, that has been posted on our blogpost.

The primary way to interact with me and the other students in this course is through the discussion forums which in our case are comments section under the lectures, social media and blogpost. Here, you can start new threads by asking questions or you can respond to other people's questions. If you have a question about any aspect of the course, I strongly suggest that you search through the discussion boards first to see if anyone has already asked that question. If you see something similar to what you want to ask, you should like that question comment to push the notification to get answered to that question quickly rather than asking your question separately. The more votes a question or comment gets, the more likely it is that I will see it and be able to respond quickly. Of course, if you don't see a question similar to the one you want to ask, then you should definitely start a new thread on the appropriate forum.

Finally, consider getting the course textbook, R Programming for Data Science, which is available for free. The content in the book tracks the material covered in the course and allows you to hang on to the material once the course is finished.



Course Description

In this course you will learn how to program in R and how to use R for effective data analysis. You will learn how to install and configure software necessary for a statistical programming environment, discuss generic programming language concepts as they are implemented in a high-level statistical language. The course covers practical issues in statistical computing which includes programming in R, reading data into R, accessing R packages, writing R functions, debugging, and organizing and commenting R code. Topics in statistical data analysis and optimization will provide working examples.

Course Content:

  • Overview of R
  • R data types and objects
  • Reading and writing data
  • Control structures
  • Functions
  • Scoping rules for R programming
  • Dates and times
  • Loop functions
  • Debugging tools
  • Simulation in R
  • Code profiling

Programming Assignments

Programming assignments will be posted for you to practice on blogpost for each topic. Plus we will cover few guided assignments and projects, during and at the end of the course.

Swirl Programming Assignment (practice)

In this course, you have the option to use the swirl R package to practice some of the concepts we cover in lectures.

While these lessons will give you valuable practice and you are encouraged to complete them all for better understanding of the core concepts that will be covered in this course, so please complete them all.

What is swirl?

Swirl is the package that is developed by John Hopkins university for the R programming class.  It's called Statistics with Interactive R Learning or SWIRL for short.  And it was developed by Nick Carchedi, who was a student then at the Johns Hopkins department of bio-statistics. This is a system that allows you to interactively learn R at your own pace. And it will walk you through a bunch of lessons about different aspects of the R language and you can practice them as you go. So, rather than just watching a lecture and then doing an assignment and doing things piece by piece, you can actually work on R right in the R console in a  guided way. Rather than just figuring things out on your own. So, I think this, the SWIRL modules are really helpful and I encourage you to try to walk through them. And it will be great learning combining lecture videos and swirl practice assignments. I think it'll be a lot of fun.

Practical R Exercises in swirl

The swirl package turns the R console into an interactive learning environment. Using swirl will also give you the opportunity to be completely immersed in an authentic R programming environment. In this programming assignment, you'll have the opportunity to practice some key concepts from this course.

  • Install R

Swirl requires R 3.0.2 or later. If you have an older version of R, please update before going any further. If you're not sure what version of R you have, type R.version.string at the R prompt. You can download the latest version of R from https://www.r-project.org/.

Optional but highly recommended: Install R Studio. You can download the latest version of R Studio at https://www.rstudio.com/products/rstudio/.

  • Install swirl

Since swirl is an R package, you can easily install it by entering a single command from the R console:

install.packages("swirl")

If you've installed swirl in the past make sure you have version 2.2.21 or later. You can check this with:

packageVersion("swirl")

  • Load swirl

Every time you want to use swirl, you need to first load the package. From the R console:

library(swirl)

  • Install the R Programming course

swirl offers a variety of interactive courses, but for our purposes, you want the one called R Programming. Type the following from the R prompt to install this course:

install_from_swirl("R Programming")

  • Start swirl and complete the lessons

Type the following from the R console to start swirl:

swirl()

Then, follow the menus and select the R Programming course when given the option. 

I am very excited to start this course and I hope you enjoy this course and I anticipate a fun time in this course!

Comments

Popular posts from this blog

What is Data? And What is Data Science Process?

The Beginner’s Guide to Data & Data Science Process About Data: In our First Video today we talked about Data and how the Cambridge English Dictionary and Wikipedia defines Data, then we looked on few forms of Data that are: Sequencing data   Population census data ( Here  is the US census website and  some tools to help you examine it , but if you aren’t from the US, I urge you to check out your home country’s census bureau (if available) and look at some of the data there!) Electronic medical records (EMR), other large databases Geographic information system (GIS) data (mapping) Image analysis and image extrapolation (A fun example you can play with is the  DeepDream software  that was originally designed to detect faces in an image, but has since moved on to more  artistic  pursuits.) Language and translations Website traffic Personal/Ad data (e.g.: Facebook, Netflix predictions, etc.) These data forms need a lot of preprocessin...

Efficient Data Manipulation with Loop Functions in R: A Deep Dive into apply and mapply

The Beginner’s Guide to Loop Functions in R: In addition to lapply and sapply , R also has apply and mapply , which are other loop functions that are commonly used for data manipulation and analysis. In this blog post, we'll explain what these functions are, how they work, and provide some practice material for beginners to intermediate level. apply:  Apply a Function to a Matrix or Array apply is a loop function in R that applies a function to either rows or columns of a matrix or array. Here's the basic syntax: apply(matrix/array, margin, function) The matrix/array argument is the matrix or array you want to apply the function to, and the margin argument specifies whether you want to apply the function to rows or columns. margin = 1 applies the function to rows, while margin = 2 applies the function to columns. The function argument is the function you want to apply. For example, let's say we have a matrix of numbers and we want to apply the sum function to each row:...

Optimization Example of Lexical Scoping in R: Exploring optim, optimize, and nlm Functions

The Beginner’s Guide to Optimization Example of Lexical Scoping in R: When it comes to optimization in R, lexical scoping can be a useful tool for optimizing complex functions that involve multiple variables. In this blog post, we will explore how lexical scoping can be used to optimize a function using the NLL (negative log-likelihood) function , and how the optim, optimize, and nlm functions can be used to perform optimization in R. Optimizing the NLL Function using Lexical Scoping The NLL function is a common function used in optimization problems. It is defined as the negative log of the likelihood function, which is used to estimate the parameters of a statistical model. In R, the NLL function can be defined using lexical scoping, which allows us to pass arguments to the function and access variables from within the function. Here is an example of how to define the NLL function using lexical scoping in R: nll <- function(data, parameters) {   # Define local variables ...