First, I would like to thank you all for loving my last blog titled – There’s more to life than what you think. I really appreciate your encouragement to write more about life. So here goes the second one.
What is life? I feel that life is the composition of ups and downs, highs and lows, successes and failures, happiness and sadness and so on. No wonder our heartbeat looks like this on a monitor.
It clearly portrays the philosophy of life. If that line was straight, we would be dead. Life is in fact mixture of failure and success. If you just try to recall what you did today, you will realize that it contained failure and success too. For example, you failed to catch the bus to work, you failed to remember the birthday of someone special and forgot to wish them, you failed the interview and got rejected, etc. These are few examples of failures that we encounter in our everyday life. Now to turn the entire scenario into success story; you managed to get a nice window seat on the bus, you succeeded in throwing a nice surprise birthday party to your loved one and made them feel special, you successfully got accepted for the new job, etc.
Failure and success is a part of life. It goes hand in hand. Everyone fails in life at one point or another. I am not being pessimistic but that is how life usually works. Failure is a reminder that you are a human. Humans fail. It’s normal to fail.
“It’s not how many times you succeed that counts. It’s not how many times you fail that counts. It’s how many times you fail and get back up that counts.”
The problem is most people associate failure with complete defeat. I can understand because I’ve failed countless times over. But through those failures, I learned some very important lessons. I realized that failures and rejections are equally important as success. I also realized that some of the most famous people to have ever lived had failed the most times.
Today, I would never take my failures back because it has shaped me to become who I am today, and I am pretty sure that the most successful people in the world wouldn’t do so either. I’ve grown stronger through those experiences. I know that failure and rejection hurt at the time, but it’s part of life’s design. When we fail, we learn. We grow and mature, achieving new understandings and perspectives on life, love, business, money, relationships, and people. Failure and rejection are there to make us stronger. Trust me, God would never give the pain if we cannot handle it.
“Life is a grindstone. Whether it grinds you down or polishes you up depends on what you’re made of.”
Below I’ve compiled failure and rejections of some great personalities and how they overcame and got back in life.
This guy was rejected and eventually fired from the company that he had created.
His response: “Sometimes life is going to hit you in the head with a brick. Don’t lose faith” – Steve Jobs
This writer was jobless, penniless, divorced, had a dependent child and was rejected by about 12 different publishers. One of them told her “you should not quit your day job”.
Her response: “It is impossible to live without failing at something, unless you live so cautiously that you might as well not have lived at all- in which case, you fail by default.” – J.K Rowling
This Director was rejected by the University of Southern California School of Theater, Film and Television. Thrice.
His response: “Failure is inevitable, success is elusive.” – Steven Spielberg.
This painter’s paintings were rejected throughout his lifetime, with only one sold.
His response: “If you hear a voice within you say, ‘you cannot paint,’ then by all means paint, and that voice will be silenced.” – Vincent Van Gogh.
This guy was fired from a local newspaper because they thought that he lacked imagination and had no good ideas. Started many businesses that didn’t last too long and ended with bankruptcy and failure.
His response: “Everyone falls. Getting up is how you learn to walk.” – Walt Disney
This lawyer was defeated for political office 7 times. His fiancé died. He failed in business. And he suffered nervous breakdown before becoming the President.
His response: “My great concern is not whether you have failed, but whether you are content with your failure.” – Abraham Lincoln
This man failed to get a job even after trying 30 times, was the only one rejected by KFC out of the 24 interviewees, failed twice during his school days, thrice during his university, applied 10 times for Harvard but rejected, allegedly started two business ventures but failed in both.
His response: “If you don’t give up, you still have a chance. Giving up is the greatest failure.” – Jack Ma
We all face rejections. It is your response to those rejections and failures that helps to grow and strengthen you from those experience. One more rejection is just another incentive to look back at your mistakes, pull yourself together and give it more than what you had given before, and keep going until you get what you had aimed for.
I would like to conclude this blog with a very famous dialogue from the movie “Rocky”.
“Let me tell you something you already know. The world ain’t all sunshine and rainbows. It is a very mean and nasty place and it will beat you to your knees and keep you there permanently if you let it. You, me, or nobody is gonna hit as hard as life. But it ain’t how hard you hit; it’s about how hard you can get hit, and keep moving forward. How much you can take, and keep moving forward. That’s how winning is done. Now, if you know what you’re worth, then go out and get what you’re worth. But you gotta be willing to take the hit, and not pointing fingers saying you ain’t where you are because of him, or her, or anybody. Cowards do that and that ain’t you. You’re better than that.”
– Rocky Balboa
GitHub is a website where you can host your code, navigate through other’s codes and collaborate with other developers who are working on the same project. GitHub is also a distributed version control system, so if you face any major error, you can always go back to the point where it was working normally.
You can use GitHub in multiple ways.
- Using stand-alone GitHub Desktop application
- Using stand-alone GitHub website
- Using Git Command Line Interface and GitHub website (combined)
However, in this blog, you will learn about the no. 3 way, i.e. Using Git Command Line Interface and GitHub which is the most common way.
[Windows] + [R] to the open Run dialog box and type
cmd to open Command Prompt and type the command
You will get the above result saying ‘git’ is not recognized as an internal or external command, operable program or batch file.
It is because you have not installed Git. I did this deliberately to show you why you must download and install Git on your computer.
Open a browser and search for ‘download git’. Click the one that says ‘Git – Downloads – Git SCM’.
You will be greeted with this page.
Under ‘Downloads’ section, select your operating system and download Git.
Keep on clicking Next (leave everything default) and install.
Once again, hit
[Windows] + [R] to open Run dialog box, type
cmd to open Command Prompt and type
git. You will see a different result this time. It will look something like this.
Congratulations! You’ve successfully installed Git. Now you can use Git from the command line.
Now, next move on to the next part.
Sign in to your GitHub account. If you haven’t signed up yet, go to https://github.com/ and create an account.
After you have signed in or created your GitHub account, it’s time to link GitHub and Git.
The first thing you should after installing Git is set your username and email address, which you just set up in GitHub. This is an important step because every Git commit uses this information. Type the following in command prompt.
git config --global user.name "Your GitHub Username"
git config --global user.email “Your GitHub Email”
Once you have configured the global username and email, go to GitHub and click on the + sign and click on ‘New Repository’.
Give your repository a name based on the project you are working. This is a test example, so I’ve set the name as ‘test_repository’. Also, write a description of it. Tick on ‘Initialize this repository with a README’. Then click on Create repository.
Once the repository is created, you will see something like this.
In the green box, you will see ‘Clone or download’. Click on it and you will see ‘Clone with HTTPS’ option with a link. Copy the given link.
The link will generally be in this order: https://github.com/username/repository_name
Open Command Prompt, and go to your desired drive. Create a folder called ‘GitHub Projects’ (optional).
Type the following code:
git clone [paste the code]
git clone https://github.com/samikshya-gautam/test_repository.git and hit enter.
Once done, it will look something like this.
Now if you go to G:\GitHub Projects, you will see that a folder named ‘test_repository’ has been created. This is the same repository that we just created on GitHub website a few moments ago. What we did is, we simply copied the whole repository into our local machine. Whatever operations we perform now will only affect the local repository, not the one on the GitHub website. Only when we are ready to commit the changes, we shall push it.
Inside test_repository, you will see two things: .git folder and a README.md file.
The .git folder contains all the information about your project. All git operations take place inside this folder. It also contains information about commits, remote repository address, etc. The good thing is we don’t have to take care of it. The README.md file contains the repository’s name and the description you provided.
Go inside the folder test_repository by typing
cd test_repository. You work inside this folder. If you have your project folder somewhere else, copy it to this folder.
For this example, I am creating a new text file called ‘TestFile.txt’ inside test_repository folder. Write some text in the text file. I’ve written ‘This is just a text file.’
In the command prompt, type
You will see the following on your screen.
You will see that ‘TextFile.txt’ is red. This means, you have made changes in your repository but haven’t added it to the staging area yet. Staging is a step before the commit process in git. So, a commit in git is performed in two steps: staging and actual commit.
git add -- all
You will see that the color of ‘TestFile.txt’ has changed into green. This means our files have been added to the staging area and are ready to commit.
git commit -m “First Commit”
You should always write a comment like “First Commit” and describe in short what changes you made in that file. For example, if you’d added a new method named ‘getElements()’ in your code and added into the staging area, then your commit should be like
git commit -m “Add getElements() method”
You should practice this so that you and other developers working on the project know what changes you did in that commit.
Once you’ve committed the final changes, it’s time to push your progress into GitHub repository.
git push -u origin master
This command says to push the commit in the branch named master to the remote named origin. When this is executed, all the stuff that you last synchronized with the origin will be sent to the remote repository (i.e. repository in your GitHub) and others will be able to see them there.
There are people who think that Git and GitHub are the same thing and use the terms interchangeably. Some might even think Git is short for GitHub. It’s probably because of similarity in their names.
Git and GitHub are NOT similar.
In a simple term, Git is a tool and GitHub is a website (which is more like a community).
In a more technical term, Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency, while GitHub is a web-based Git repository hosting service, which offers all the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.
Git was created by Linus Torvalds, creator of Linux kernel.
Linus Torvalds was the designer of the open-source operating system Linux.
What is Git?
Git is a tool for version control which is primarily used by programmers. It runs with the command line on your local machine and allows you to keep track of your files and modifications made to those files in something called a ‘Repository’ or ‘Repo’. You can use it alone as well as with a team of people who are working on the same project. It’s useful in a team environment because everyone can work independently on those files, merge their changes together and there’s a permanent record of who made what change.
What is GitHub?
GitHub is a website that allows you to upload your Git repositories online.
Why would you want to host your files on GitHub?
Because it provides a backup of your files and gives you a visual interface for navigating your repositories. It provides other people a way to navigate your repositories. It also makes repo collaboration easy. GitHub is more common if you are using Git.
This example will make you clearer about what Git and GitHub are.
Consider you are a professional photographer and you use Adobe Photoshop to process your photos. You take the photos, edit them in Photoshop and when it’s ready, you upload them to your Facebook page.
In this context, Git is Adobe Photoshop and GitHub is Facebook.
You write your codes and compile it, it runs without any error. You add more codes or make changes to the existing codes, re-compile it and suddenly you are greeted with errors. Then the developer spends additional time searching for the mistake and correcting it. Every developer must have faced this situation. Things might be simpler if he is working on a smaller project, but such situation would be very challenging on a larger one. A single change or update to the existing code might cause an error and result in hours of hard work to fix it. This is where version control comes in.
What is Version Control?
Version Control is the management of changes designed to keep track of multiple versions of documents, computer programs, large websites, and other collections of information. It is also known as revision control or source control.
Version Control allows developers to save any or all changes that are made to their code. If they ever face the situation as mentioned above, they can simply turn their code back to the state when it was working, instead of be spending additional hours finding the mistake that broke the code. Developing software without using version control is risky because it is like not having backups.
Version Control System also allows multiple developers to work on a single project and save the changes to ensure that everyone can keep track of what they are working on. Version control also allows traceability, i.e. it allows the developers to trace every change made to the software over time.
Types of Version Control
There are three different types of Version Control Systems – Local, Centralized and Distributed.
- Local Version Control Systems
Local version control system is a traditional approach, where you copy individual files from each computer into another directory. You save the changes in the form of patch sets, where the patch sets are dated and time-stamped. So, in case of the code breaks, the patch sets can be used to re-create what the file previously looked like.
- Centralized Version Control Systems
Centralized Version Control approach was created to solve the problem of collaboration. It has a single central copy of the project on a single server or a repository and if you commit any changes, the changes are directly made to that central copy. You take the files from that repository, work on it and put it back. In centralized version control, you never have a full copy of your project locally. Since this works like a central hub, so the major problem is that all the data would be lost in case the server fails.
CVS, Subversion, perforce are some popular centralized version control systems.
- Distributed Version Control Systems
Distributed Version Control Systems was created to solve the problem of centralized version control systems. In distributed version control, you don’t rely on a central server to store all the versions of a project’s file. Instead, you clone a copy of that repository locally so that you are not working on the original file. You work on the cloned copy of the project, and once all the changes are finalized, you can commit and make changes to that original file.
Another benefit of using distributed version control is it allows the developer to work on multiple projects at the same time.
Git is the most popular and widely used distributed version control system today.
R is one of the most popular choices of language to learn data science. Despite this fact, most beginners often find themselves lost or confused about finding out the right learning path. The internet is filled with data science and R learning materials which could be overwhelming at first.
Like the saying ‘Think Twice, Code Once’, if you have a well-guided layout, you can save time and effort. This blog will help you lay out a clear systematic approach to learning R for data science.
1. Download R and RStudio
The first thing you need is R, which is the core piece. R is free and open-source language and environment for statistical analysis. The next thing you need is RStudio, which is a nice integrated development environment (IDE) that makes it much easier to use R.
Download R from HERE
Download RStudio from HERE
If you open R itself, it will look very plain.
It is not necessary to open RStudio to use R, but having RStudio as your default IDE for R development makes R a little more user-friendly as it provides all the plots, package management and the editor in one place.
2. Get familiar with the RStudio IDE
When you first open RStudio, this is what you see.
The left panel is the console for R. Type 1 + 1, hit ‘Enter’ and R will return the answer.
It’s a good idea to use a script so you can save your code. Open new script by selecting File -> New File -> RScript and it will appear in the top left panel of RStudio.
It’s basically a text document that can be saved (File -> Save As). You can type and run more than one line at a time by highlighting and clicking the ‘Run’ button on the script toolbar.
The top right panel gives you information about what variables you’re working with during your R session.
The bottom right panel can be used to find and open files, view plots, load packages, and look at help pages.
3. Learn the basics
The next thing is to learn the basics of R. Try doing some math operations.
Create a variable
To create a variable in R, we use:
Variable <- Value
e.g. number <- 1
Learn about variable types
R has three main variable types – character, numeric and logical.
Learn about Grouping Data
Learn about Vectors, Lists, Matrix, Data Frames.
Vectors – contain multiple values of the same type (e.g., all numbers or all words)
Lists – contain multiple values of different types (e.g., some numbers and some words)
Matrix – a table, like a spreadsheet, with only one data type
Data Frames – Like a matrix, but you can mix data types
Learn about Functions
Functions are a way to repeat the same tasks on a different data.
e.g. x <- c (2, 4, 5, 6, 10)
Another example of a function is plot ().
To write a comment, type # in front of your comment. Comments do not get evaluated.
e.g. #This is a comment
4. Learn to access the help files
This will be the most useful tool. You should learn how to get the help of a particular function, search the help files for a word or phrase and find help for a package.
?function_name –> get help of a function
help.search (‘phrase’) –> search the help files for a word or phrase
e.g. help.search (‘weighted mean’)
help (package = ‘package_name’) –> find help for a package
e.g. help (package = ‘dplyr’)
5. Learn about R packages
R comes with basic functionality, meaning that some functions will always be available when you start an R session. However, you can write functions for R that are not the part of the base functionality and make it available to other R users in a package. Packages must be installed first then loaded before using it.
To install a package, click on the ‘Packages’ tab on the bottom right panel of RStudio and then click ‘Install’ on the toolbar.
Once you click on ‘Install’, a window will pop up. Now type the name of the package into the ‘Packages’ box, select that package, and click ‘Install’.
Now that you’ve installed the package, you still can’t use the function you want. You must load the package first. For this, you will have to use the library () function to load ‘dplyr’ package (for example).
You don’t have to download the package again once you close and re-open RStudio, but you do need to load the package to use any function of it.
6. Data Loading
Getting the data into R is the first step of the data science process. R has varieties of options to get data of all forms into R. This is a common list of packages best suited for data loading.
7. Exploring the data
Use the following code to obtain the data.
airquality is a data frame that comes inbuilt so that you can play with the data.
Try the following commands and see what you get:
Viewing the data
RStudio has a special function called View () that makes it easier to look at data in a data frame.
8. Data Analysis and Visualization
After learning how to get data into R, and some data exploration techniques, now it’s time to learn some exploratory analysis. Install a list of some wonderful R packages given below that helps to simplify data analysis and visualization.
· dplyr – helps you do simple and elegant data manipulation
· data.table – handles big data with ease, provides faster data analysis
· ggplot2 – awesome package for data visualization
9. Data Preparation
Data preparation is another important step because clean data is hard to find, and often needs to be transformed and molded into a form on which we can run models.
· reshape2 – melt and cast the dataset into the shape you want
· tidyr – provides a standardized way to link the structure of a dataset (its physical layout) with its semantics (its meaning)
· Amelia – missing value imputation
10. Communicate Result
You have learned to extract insights from data, but it could be useless without effective communication or display of result. R Markdown is a great tool for reporting your insights and share your findings with a fellow data scientist.