How to create R Package using RStudio?

Part A: Create the package

1. Click File –> New Project…


2. Under “New Project” Dialog, Click “New Dirctory



3. Click “R Package



4. Profide a “Pakage name

5. Add your files which you want to be packaged.

6. May specify a path where you want this package to be created.


7. Click “Create Project

Have a look at this area of RStudio. May do any manipulations, like additing package dependencies.


Now, click menu Build –> “Build and Reload


You can see it is building:


Test your library. The sample R file which I used had only one function called TestFunction()


8. Next, you can package it. Click Build –> “Build Binary Package


You can go to the folder spcified initially to see the ZIP file created.


Part B: Install the package

1. Choose “Install from:”Package Archieve File

2. Choose the “Package archive” by clicking “Browse…” button

3. Click “Install




Happy R Packaging!


Change missing values in Data Frame to NA in R


In the news: Get a Microsoft Professional Degree in Data Science


Microsoft consulted Data Scientists and the companies that employ them to identify the requisite core skills. We then developed a curriculum to teach these functional and technical skills, combining highly rated online courses with hands-on labs, concluding in a final capstone project. Graduates earn a Microsoft Professional Degree in Data Science—a digitally sharable, résumé-worthy credential.

More details here:


Hello World in Windows 10 IoT Core on Raspberry Pi

Yeah, I know it’s a bit late but I hope still someone will find this useful. Here goes a “Hello World” experiment which displays a “Hello World” and programmatically blinking the LED, which is the activity LED built-in available in the Raspberry Pi Model B Board.

[This post has been in my drafts folder for a long time due to some technical glitches. So please forgive any outdated content]

Here goes the device which I have used for experimenting –> Raspberry Pi2 (which is the latest available at the time of this article)


Here are the steps I did to kick start.

Hardware Configuration

  1. Raspberry Pi 2 Model B
  2. 5V Power Adapter
  3. USB Keyboard
  4. USB Mouse
  5. WiFi Dongle
  6. TV which supports HDMI & HDMI Cable
  7. SD Card with Windows 10 IoT core for Raspberry Pi pre-loaded

Software Configuration

  1. Visual Studio 2015 Community Edition (with latest updates)

Hello World Sample

STEP 1 – Start with project template

Start with a Blank Universal Windows App. So that you can test your initial program in your laptop/PC itself – i.e., before you deploy it in Raspberry Pi you can have a sneak peek.


STEP 2 – Action

I have these functionalities:

  1. Display a “Hello, World!” message when you execute the application
  2. Display a message “Hello, Windows IoT Core” when you click a button
  3. A button to “Exit” the application
  4. Switch ON the GREEN LED on the Raspberry Pi board up on clicking “LED ON” button
  5. Switch OFF the GREEN LED off the Raspberry Pi board up on clicking “LED OFF” button

My MainPage.xaml looks like this:

{code goes here}

Code behind – MainPage.xaml.cs looks like this:

STEP 3 – Execute the program in Raspberry Pi

Make sure you have connected to your WiFi from Raspberry Pi. Here in this example, I am demonstrating how to connect to it from Visual Studio to execute the app.

First, Make sure you have “ARM” processor type selected instead or x86 or x64.


Select “Remote Machine”.

Most probably your Raspberry Pi wil be auto-detected so you just have to select it. Otherwise, provide the IP address which is shown in the Raspberry Pi screen in the field.




Run the solution / Press F5. You will soon see the app up and running in Raspberry Pi screen. Now test the functionality.



  1. Sample –
  2. Pin Mappings –
  3. LED operation sample –

read.csv on R thorws error line “1 appears to contain embedded nulls”

If your read.csv (in openxls) fails by throwing this warning message:

Warning messages:

1: In read.table(file = file, header = header, sep = sep, quote = quote, :

line 1 appears to contain embedded nulls

First thing you might want to try is to check the encoding, or simply trial and error by adding fileEncoding = “utf-16”.



df = read.csv("sample.txt", header=TRUE, sep = "|",fileEncoding = "utf-16")


.NET Core – Kick-start with “Hello World” in Linux/CentOS

I am considering version CentOS 7.1 in this example. You can read more details installation of .NET Core on various platforms here.
I am using puTTY, a remote connection tool to connect to my CentOS VM.

Install and configure SDK

Step 1: Install Dependencies libunwind and libicu

If you are interested to know what are libunwind and libicu, please use google. Otherwise please just keep in mind that these libraries are required for the proper functioning of “dotnet” command.
Command: sudo yum install libunwind
Command: sudo yum install libicu

Step 2. Download the dotnet.tar.gz file

Command: curl -sSL -o dotnet.tar.gz

Step 3. Create folder /opt/dotnet

Command: sudo mkdir -p /opt/dotnet

Step 4. Extract dotnet.tar.gz to newly created folder /opt/dotnet

Command: sudo tar zxf dotnet.tar.gz -C /opt/dotnet

Create and Test “Hello World” program

Step 1: Create project folder

Create a folder and change the current folder to the newly created one. This is mainly to make sure we do not make unnecessary mess in the root or somewhere else.
Command: mkdir MyNETCoreTest
Command: cd MyNETCoreTest/

Step 2: Create basic project environment

Apply command “dotnet new”. Since the command is not included in path, you might need to use the full path “/opt/dotnet/dotnet”.

Check the folder (command: ls) to see if two files are created:

  1. program.cs – the project file. You may check the file contents. You can see a basic “Hello World” program with a Main() method. You can edit the file if wish. I have edited and added a new line.
  2. project.json – project file


Step 3: Restore Dependencies

Apply the command “dotnet restore”. This command will restore any necessary packages for the project. You can also see a new file “project.lock.json” also created.

Step 4: Compile and Execute the program

Finally apply the command “dotnet run”. This command will compile the project – if this project is new, or if any files are modified. Then this will execute the program.

Happy Programming!


.NET Core – Kick-start with “Hello World” using Visual Studio

First, make sure you have (at the time of writing this article) below prerequisites already:

  1. Visual Studio 2015 Update 3
  2. .NET Core 1.0 for Visual Studio

I will not be explaining what is happening behind the screens or about the architecture whereabouts since this article is intended to be a kick start-with-the-technology article. I will be demonstrating a .NET Core console based application using Visual Studio 2015.
If everything is ready, let us start! 

Step 1: Create Project

On Visual Studio, create a new project via File → New → Project → Templates → Visual C# → .NET Core, then select the template “Console Application (.NET Core)
You will have to select the .NET framework version 4.5 or above to see the .NET Core specific templates. I will go with .NET Framework 4.6.1 for this example.

Click Ok, and you may wait for sometime to finish installing the packages.

Step 2: Display “Hello World”

Write your “Hello World” program. Here is mine:

Step 3: Execute the Program

Hit F5 or Run the program and confirm there are no errors.
Ok, mine is success:

Step 4: Publish the Project

Right click on the project in Solution Explorer then choose Publish…

  1. If this is your first time publishing, you will be asked to choose a publish target.
  2. Type a profile name and click OK.

Next, you can either click on “Next >” and modify connection or other settings or directly click “Publish

Step 5: Execute the Published application

Take command-line and navigate to your published folder. My folder looks like this:

Apply the command:
> dotnet <filename.dll>
Happy Programming!


.NET Core – Kick-start with “Hello World” using command line

This example demonstrates the creation of a .NET Core console application and execute it. Whereabouts of what is happening behind the screen and architecture will be discussed in upcoming articles.
Download .NET Core which is the prerequisite for this example should be present in your system. You can download it from here –

Step 1: Create a folder

Create a folder so that all your project files will be saved in one place.

Step 2: Initialize a basic .NET project

Use the command “dotnet new” to create a basic project.
You can see in the folder that two files are created.

  1. Program.cs – A “hello world” console application program. Check the source by opening in notepad or another editor. You can find the Main() method, which is the starting point of a console application in it.
  2. project.json – the project file

You can modify Program.cs if wish to experiment. I have added one more line in my example:

Step 3: Restore the dependencies

Apply the command “dotnet run” so that it will restore any project dependencies. Will be discussed in detail later.
You can see an additional file generated which is project.lock.json.

Step 4: Compile and Run the project

Finally, apply the command “dotnet run”. This command will compile the project, then executes it.

Note that, if it is a new .cs file, or if there are any modifications then you can see the compilation output in the console. Else it will skip the compile phase.

Happy Programming!


K-MUG Machine Learning Day @ Orion India–Personal Review

It was just one week back we announced this special event as the speaker will not be available for a some time after this week so we had to organize this event today (9/July/2016). Despite the fact that it was a short notice and is mostly a non-technical topic, and unexpected morning rains, I was personally expecting a small crowd when compared to our regular K-MUG events but surprisingly we had 25+ audience attended from various companies – Orion, Envestnet, UST Global,  TCS, Tranzmeo, Pinnpark, Wowmakers, Identitymine, Suyati, Entri, Profoundis, etc. to name few. Came to know from the kind of questions asked by audience, and pep talks at networking break – it is found that most of the people were somehow working on Data Analytics topics. This clearly shows where our industry trends are heading to.
It was at the venue of MobConf last month, Praseed Pai promised to me to take a K-MUG session on Practical Machine Learning. I was always enthusiastic about Data Science and I also decided that time itself to take a session on Microsoft Azure Machine Learning. Thankfully everything went fine, as usual Orion India Systems agreed to sponsor and organize the event by providing venue (a 60 seat training hall), refreshments and volunteers.
Dr. Arun Marar, Project Head for Data Science at ORION kick started the event on time by giving a short talk on the theme.
Praseed Pai made our day by starting from basics of statistics to advanced topics like Decision Trees and Apriori Algorithm. He explained everything using real life examples so that even a novice in the field can easily follow. We ended the program by 1:15PM and agreed to organize a Hackton soon.
Below are the slides I prepared for my Microsoft Azure Machine Learning session:

Here is the social media and mail flyer I designed for the event: