Project in R – Uber Data
Analysis Project
Talking about our Uber data analysis project, data
storytelling is an important component of Machine
learning through which companies are able to understand
the background of various operations. With the help of
visualization, companies can avail the benefit of
understanding the complex data and gain insights that
would help them to craft decisions. You will learn how to
implement the ggplot2 on the Uber Pickups dataset and at
the end, master the art of data visualization in R.
Importing the Essential Packages
In the first step of our R project, we will import the
essential packages that we will use in this uber data
analysis project. Some of the important libraries of R that
we will use are –
ggplot2
This is the backbone of this project. ggplot2 is the most
popular data visualization library that is most widely used
for creating aesthetic visualization plots.
ggthemes
This is more of an add-on to our main ggplot2 library.
With this, we can create better create extra themes and
scales with the mainstream ggplot2 package.
lubridate
Our dataset involves various time-frames. In order to
understand our data in separate time categories, we will
make use of the lubridate package.
dplyr
This package is the lingua franca of data manipulation in
R.
tidyr
This package will help you to tidy your data. The basic
principle of tidyr is to tidy the columns where each
variable is present in a column, each observation is
represented by a row and each value depicts a cell.
DT
With the help of this package, we will be able to interface
with the JavaScript Library called – Datatables.
scales
With the help of graphical scales, we can automatically
map the data to the correct scales with well-placed axes
and legends.
Input Screenshot 1:
Input Screenshot 2:
Input Screenshot 3:
[Link] vector of colors to be
implemented in our plots
In this step of data science project, we will create a vector
of our colors that will be included in our plotting
functions. You can also select your own set of colors.
Code:
Input Screenshot 4:
3. Reading the Data into their
designated variables
Now, we will read several csv files that contain the data
from April 2014 to September 2014. We will store these
in corresponding data frames like apr_data, may_data, etc.
After we have read the files, we will combine all of this
data into a single dataframe called ‘data_2014’.
Then, in the next step, we will perform the appropriate
formatting of [Link] column. Then, we will proceed
to create factors of time objects like day, month, year etc.
Code:-
Input Screenshot 5:
Code:
Input screenshot – 6
Plotting the trips by the hours in a day
In the next step or R project, we will use the ggplot
function to plot the number of trips that the passengers
had made in a day. We will also use dplyr to aggregate
our data. In the resulting visualizations, we can
understand how the number of passengers fares
throughout the day.
Code :-
Input Screenshot 7:
Output
Code:-
Input Screenshot 8:
Input Screenshot 9:
Output:
Output:
Summary
At the end of the Uber data analysis R project, we
observed how to create data visualizations. We made use
of packages like ggplot2 that allowed us to plot various
types of visualizations that pertained to several time-
frames of the year. With this, we could conclude how
time affected customer trips. Finally, we made a geo plot
of New York that provided us with the details of how
various users made trips from different bases.
Hope you enjoyed the above R Data Science Project.
Keep visiting DataFlair for more interesting projects
related to the latest technologies like Big Data, R and
Data Science. If you face any issue while practicing the
same, comment us below. We will definitely help.