Introduction

The purpose of this page is to discuss, swirl, a software package that can be used to help users teach or learn R. To begin, we will discuss swirl’s background and capabilities. Next we will show how students and teachers can learn from and teach using the platform. An example of using swirl will round out our learning. Finally, resources and references to learn more will be provided.


What is swirl?

swirl is an interactive environment that assists people in learning R programming. It is a self-paced program intended for all users. The free and open source software allows interested parties to share and develop ideas using swirl without any concerns of sharing the property. swirl can be used by teachers and students alike for teaching and learning purposes. swirl allows the public to help improve the software by providing swirl’s source code and a link to their discussion group.

NOTE: To access swirl, the function needs to be ran within R. The program can only be exited manual within R. As a result, all lines of codes are commented out to prevent the program from running and causing an infinite loop.


Learning on swirl

To access swirl, interested parties will need a computer with the latest version of R downloaded and access to the Internet. swirl’s creators recommend using RStudio when running swirl, however, it is not required. Once R or RStudio is opened, swirl needs to be downloaded.

#install.packages("swirl")

To run swirl, students will have to load the library and run the function.

#library("swirl")
#swirl()


Creating a Lesson

As previously mentioned, the first step is to download the latest version of R. RStudio can also be downloaded for a better interface, but it is not required. Once R or RStudio is opened, swirl and swirlify need to be downloaded.

#install.packages(c("swirl", "swirlify"))

Next, the swirlify package should be loaded.

#library(swirlify)

To open swirlify, one of the following codes should be ran. Teachers can create a new lesson in their current directory. Where “My Lesson” is within the “My Course” folder.

#new_lesson("My Lesson", "My Course")

Lessons previously written interactively or directly.

#set_lesson() # Set the lesson interactively

OR

#set_lesson("path/to/My_Course/My_Lesson/lesson.yaml") # Set the lesson directly



Using swirl in R

The creators of swirl offer their users several different courses by providing links for their ‘course repository’and their ’Swirl Course Network’ on their FAQ page. Within their course repository they offer links to different courses based on the users their expertise.

One of the courses featured in their Beginner level, R Programming E, teaches users the basics. Their lessons include topics such as ‘Basic Building Blocks’, ‘Vectors’, and ‘Functions,’ among others. To get started, users run the code listed below.

Loading the Program

Users are greeted and asked to sign in. Loading Screen

Choosing the Course

The next menu lists the courses the user has loaded into R. Choosing Course

Choosing the Lesson

Users select a lesson to learn about. Choosing Lesson

Lesson Example

Throughout the program, users are given instructions on how to proceed and the percentage of the lesson they have completed. Lesson Example


Uninstalling Courses

After users have completed a course or are ready to remove a course from their repertoire, there is an option to uninstall courses. To do so, users only need the name of the course. Users will run the follow code.

#uninstall_course("Course Name Here")

Further Resources

Learn more about [package, technique, dataset] with the following:




Works Cited

This code through references and cites the following sources: