One does not simply do Data Science - Everyday graphs using R (Part 1)
Working with data demands value generation. There is an urgent need to draw stories, color the numbers in patterns which can help in indicating lows and highs, constants and spikes. More data and no analysis makes Jack a dull boy. Okay without much ado, I would refer to first few things to understand when you are doing graphs, plots and stories.
1. Which chart to use.
I always refer to this beautiful chart, helpful in channeling my approach towards data and charts. Thanks to AndrewAbela.
2. Know your audience.
Decide well before which team is actually viewing the data; the marketing team, the tech team or the C-C-level officers and then frame the story according to the needs.
3. In what context do we want to use the data?
Simple analysis, some graphs can be helpful, building a story might be useful or landing up with some keypoints.
R is an open source tool to play around with the datasets and visualize important insights in form of charts and graphs. Few easy code snippets for everyday charts that can be created with R. Below is the test data to run the code and create some easy visualizations.
STACKED BAR CHART:
library("ggplot2")
df <- data.frame(
group = c("PDF", "CSV", "ZIP", "HTML"),
value = c(60, 20, 5, 15)
)
bp<- ggplot(df, aes(x="", y=value, fill=group))+
geom_bar(stat = "identity")
print(bp)
BAR CHART:
library("ggplot2")
df <- data.frame(
group = c("PDF", "CSV", "ZIP", "HTML"),
value = c(60, 20, 5, 15)
)
bp<- ggplot(df, aes(x=group, y=value, fill=group))+
geom_bar(stat = "identity")
print(bp)
PIE CHART:
library("ggplot2")
df <- data.frame(
group = c("PDF", "CSV", "ZIP", "HTML"),
value = c(60, 20, 5, 15)
)
bp<- ggplot(df, aes(x="", y=value, fill=group))+
geom_bar(stat = "identity")+
coord_polar("y")
print(bp)
You can take a quick peek at TechCouple for how to start using R.
Simple and easy to try graphs, don't forget to install "ggplot2" library before you run the codes. Worth bookmarking to modify simple ones into more interesting charts.