Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member184566
Active Contributor
0 Kudos

Intro

This is part 5 of a series of blogs.



Please refer to the other parts that can be found here

From R to Custom PA Component Part 1

From R to Custom PA Component Part 2

From R to Custom PA Component Part 3

From R to Custom PA Component Part 4

In this blog I'm going to focus on how to use swirl. Swirl is a package that we will load that will allow you to learn R in R. This will be the last blog in my series explaining normal R syntax and programming. Blogs to follow will focus purely on using the R code in Predictive Analytics to make a component.

So I thought it would be good to end the R learning part of my blogs with a way for readers to further learn and expand their knowledge on R on their own.

Swirl is not part of the default installation, we will need to install this library to use it. There is two ways to install the libraries. One being straight forward, simple and more automatic. Then another one being more manual, but is good to know in instances where you have problems with automated method.

Swirl - Automatic Library Install

As mention in part 1 of my blogs, we can see the libraries available for us to use in this directory. You will see that there is nothing for Swirl.


If you try to load the library swirl you will get a message saying it does not exist.

The simplest and easiest way to install is to do the command install.packages("swirl")

Then choose CRAN mirror, me being from South Africa I will select the Johannesburg one.

Will then download all the required packages automatically and attempt to install.

Once it is completed you will see that it installed the packages it downloaded. Will also let you know where it downloaded the packages to.

You will also see your library is updated with the new packages.

Swirl should now work, jump to the "Start Swirl" section.

Swirl - Manual Library Install

As mention in part 1 of my blogs, we can see the libraries available for us to use in this directory. You will see that there is nothing for Swirl.

If you try to load the library swirl you will get a message saying it does not exist.

You will need to download the packages required here https://cran.r-project.org/bin/windows/contrib/3.1/

You will download a zip file.

You will need to download swirl, httr, R6 and yaml as a minimum. But it is recommended you should also include jsonlite, mime and curl.

Then to install the package, open the RGui. Select "Install package(s) from local zip files". Select the zip file you downloaded previously.

You will then get a message in RGui that it installed successfully. Will also now see it in your library folder.

You will need to repeat this for the libraries swirl, httr, R6, yaml, jsonlite, mime and curl..

Start Swirl

Once you have done the above you can now load the library swirl, then start swirl with the command swirl(). It will guide you, ask questions and you need to provide answers. There are a few courses, you will need to install the courses. If you are connected to the internet it will do it for you. Alternatively you can ask it to open the github repository and do a manual install.

You can now carry on learning R at your own pace, swirl will guide you and show you the commands step by step.

Hope this is helpful. Hope you will use swirl to learn more R. Part 6 can be found here From R to Custom PA Component Part 6.

Labels in this area