Learn R – How to Fix Read.Table Command Reading Lesser Rows

This article represents the problem statement related with read.table reading fewer or incorrect or lesser number of lines or rows when reading a text file having multiple columns, and the solution to the same. This is going to be a shorter blog. But since it solved a problem on which I spent some time, I chose to write about the same. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Problem Statement: Reading Fewer Lines with read.table Command I have been learning the naive bayes classification. I downloaded this SMS collection data. I went ahead and tried to load …

Continue reading

Posted in Big Data. Tagged with , .

Data Science – Data Cleaning R Commands for Text Classification Problems

This article represents concepts and related R command set used to clean the text in order to make it ready for text classification. The R command set belongs to tm package. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Lets load a set of messages along with appropriate classification using following command. messages <- read.table( file.choose(), sep=”\t”, stringsAsFactors=FALSE) The messages data frame could have two features, such as type and text where each piece of text is associated with an appropriate type. Once done, lets go ahead and create a Corpus object out of all the message text. …

Continue reading

Posted in Big Data. Tagged with , .

Data Science – Common Exploratory R Commands for Classification Problems

This article represents common exploratory R commands that could used during the stage of data preparation when solving classification problems. I found them being used when I have been going through KNN or naive Bayes algorithms. I know that there may be more to the list below. I would love to hear those additional commands from you. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos.   In the set of commands listed below, a data frame, message_text, is used which is a set of text data, loaded using read.table command such as following: messages_text <- read.table( file.choose(), sep=”\t”, …

Continue reading

Posted in Big Data. Tagged with , .

Productivity – Sublime, AngularJS, Bootstrap Form Template

This article represents sublime text editor snippet code sample for an AngularJS-Bootstrap form template which could be used to quickly create an angular app with a simplistic bootstrap form. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Following are the key points described later in this article: Why AngularJS-Bootstrap Form Template? How to Create Sublime Snippet? Code Samples – AngularJS-Bootstrap Form Template   Why AngularJS-Bootstrap Form Template? Many a times, I wanted to experiment with AngularJS features on an HTML form. This required me to re-write or copy & paste angularjs code and bootstrap form code and create …

Continue reading

Posted in Javascript, Web. Tagged with , .

Data Science – List of Key Machine Learning Algorithms

This article represents a list of key machine learning algorithms which are most widely used by data scientists while doing data analysis. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. The list of machine learning algorithms presented below covers some of the most important and widely used algorithms which could set a stage for one to get started with data science/analytics and create models for predictions. Following are two high level classifications in which these machine learning algorithms fall under: Supervised learning Unsupervised learning Following are some of the key tasks that are performed by machine learning algorithms …

Continue reading

Posted in Big Data. Tagged with .

Learn R – How to Add New Column to Data Frame

This article represents concepts and code samples on how to add new columns to a data frame using R programming language. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Lets create a student data frame. Following is the code: # Create non-empty data frame with column names # Assign names to x x <- c( “Calvin”, “Chris”, “Raj”) # Assign names to y y <- c( 10, 25, 19) # Create a non-empty data frame with column names # Assign x to “First Name” as column name # Assign y to “Age” as column name student <- data.frame( …

Continue reading

Posted in Big Data. Tagged with , .

AngularJS – Sublime Template for Hello World

This article represents sublime snippet code sample which you could use to create an auto-complete hello world template to quickly get started with Hello World code for AngularJS. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Following are the key points described later in this article: Why Sublime Snippet for AngularJS Hello World How to Create HelloNG Snippet? Code Samples   Why Sublime Snippet for AngularJS Hello World Many a time, while starting on new AngularJS app for doing quick POC or testing purpose, I ended up creating boilerplate code or copied and pasted minimum AngularJS app code …

Continue reading

Posted in Javascript, Web. Tagged with .

Learn R – How to Convert Columns from Character to Factor

This article represents different ways in which one or more columns in a data frame could be converted to factor when working with R programming language. Please feel free to comment/suggest if I missed mentioning one or more important points. Also, sorry for the typos. Following are the key points described later in this article: Convert single column to factor Convert multiple columns to factor Following data frame, df, is used in the code sample below: In above data frame, both diagnosis and param_d are character vectors. One could quickly check classes of all columns using the following command: Convert Single Column to Factor Following is demonstrated the code samples …

Continue reading

Posted in Big Data.

Data Science – How to Scale or Normalize Numeric Data using R

This article represents concepts around the need to normalize or scale the numeric data and code samples in R programming language which could be used to normalize or scale the data. Please feel free to comment/suggest if I missed mentioning one or more important points. Also, sorry for the typos. Following are the two different ways which could be used to normalize the data, and thus, described later in this article: Why Normalize or Scale the data? Min-Max Normalization Z-Score Standardization Why Normalize or Scale the data? There can be instances found in data frame where values for one feature could range between 1-100 and values for other feature could …

Continue reading

Posted in AI, Big Data, Data Science. Tagged with , .

Learn R – How to Append Rows to Data Frame

This article represents concepts and code samples on how to append rows to a data frame when working with R programming language. Please feel free to comment/suggest if I missed mentioning one or more important points. Also, sorry for the typos. Following are the key points described later in this article: How to append one or more rows to an empty data frame How to append one or more rows to non-empty data frame For illustration purpose, we shall use a student data frame having following information: How to Append one or more rows to an Empty Data Frame Following code represents how to create an empty data frame and …

Continue reading

Posted in Big Data. Tagged with , .

Learn R – How to Create Data Frame with Column Names

This article represents code in R programming language which could be used to create a data frame with column names. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Following are the key points described later in this article: Create empty dataframe with column names Create non-empty dataframe with column names Create an Empty Dataframe with Column Names Following is the code sample: Following gets printed:   Create non-empty Dataframe with Column Names Following is the code sample: Following gets printed. Note the column names such as “First Name” and “Age”  

Posted in Big Data. Tagged with , .

Learn R – How to Extract Rows & Columns from Data Frame

This article represents command set in R programming language, which could be used to extract rows and columns from a given data frame. When working on data analytics or data science projects, these commands come very handy in data cleaning activities.  This article is meant for beginners/rookies getting started with R and wanting to know or see examples of extracting information from a data frame. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Following are the key points described later in this article: Commands to extract rows and columns Command to extract a column as data frame Command …

Continue reading

Posted in Big Data. Tagged with , .

Data Science – How to Load Data included with R

This article represents different ways in which data from different R packages could be loaded. One of the important aspect of getting on aboard with Data Science is to play with data as much as possible while one is going through the  learning phase. When doing that, some of the key activities include data loading, data extraction, data wrangling/munging etc. This is where I found that loading data from different R packages is one of the key to get access to these data sets and hence, decided to write this quick article. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for …

Continue reading

Posted in Big Data. Tagged with .

ReactJS – Online Playground for JSX-HTML Expertise

This article represents quick introduction to online playground for JSX to HTML conversion and vice-versa. Very handy for those, especially the Javascript beginners, to get a hang on component-oriented programming related with ReactJS which is at the heart of it. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos.   Following are the key points described later in this article: HTML to JSX Compiler JSX to HTML Compiler Following are two online tool or playground to enhance familiarity with JSX. HTML to JSX Compiler: This Online playground for HTML-JSX compiler would help you to write HTML on one end, …

Continue reading

Posted in Javascript, Web. Tagged with , , .

AngularJS – How to Handle XSS Vulnerability Scenarios

This article represents different scenarios related with XSS (cross-site scripting) and how to handle them appropriately using AngularJS features such as SCE ($sceProvider) and sanitize service ($SanitizeProvider). Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Do visit the page, how to prevent XSS attacks in Angular 2.*, Angular 4.* or Angular 5.*, if you are looking forward for handling XSS vulnerabilities in latest version of Angular apps. You may also want to check the page, Top 10 Angular Security Best Practices vis-a-vis vulnerability issues. Following are the key XSS-related scenarios described later in this article: Escape HTML completely …

Continue reading

Posted in Application Security, Javascript, Web. Tagged with , , , .

AngularJS – Two Ways to Initialize an Angular App

This article represents code samples along with related concepts for two different ways in which Angular app can be defined. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Following are the key points described later in this article: Automatic Initialization Manual Initialization   Automatic Initialization All that is needed for automatic initialization (as of current AngularJS version) is to define “ng-app” on an element and you should be all set. Take a look at following code sample. Pay attention to some of the following: ng-app=”HelloApp” defined on div element ng-controller=”HelloCtrl” defined on the same element. It could as …

Continue reading

Posted in Javascript, Web. Tagged with .