Skip to content

b-aishpatil/Visualization-in-R

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Visualization-in-R

  1. R Studio Commands
  2. Visualization Commands

R studio commands

  1. How to clear R studio console CNTRL + L

  2. installing ggplot libararies

install.packages('ggplot2', repos='http://cran.us.r-project.org')
  1. import ggplot
library(ggplot2)

Visualization Commands

  1. How to load dataset
cricket <- read.csv("C:/Users/User/Downloads/cs.csv")
  1. How to view data
View(cricket)

image

  1. To get data from head
To get first 7 rows To get all rows except last 7
head(cricket,7)
head(cricket,-7)

  1. To get data from tail
To get last 7 rows To get all rows except last 7
tail(cricket,7)
tail(cricket,-7)

  1. To summaries dataset
summary(cricket)

image

  1. Creating pie-chart
pie(table(cricket$Country), main = "Pie Chart of the cricket data set of contries", col = c("orange","pink","red","blue","yellow","green","violet"), radius = 1)

image

  1. Plotting Histogram
hist(cricket$Sixes, col=c("green", "red", "blue"), xlab="Number of Sixes", ylab= "Frequncy of Sixes", main="Histogram of Sixes")

image

  1. Plotting Scatterplot
plot(cricket$Fifties~cricket$Hundreds,xlab="Hundreds" ,ylab="Fifties", main="Scatterplot for Hundreds vs Fifties", col=c("blue", "red"),pch=16)

image

  1. Plotting Scatterplot with background theme and symbols
ggplot(data=cricket,aes(y=Fifties,x=Hundreds,col=Country))+geom_point()

image

  1. Plotting Barchart with background theme and symbols
ggplot(data=cricket,aes(x=Hundreds,fill=Country))+geom_histogram(bins=50)

image

  1. Alternative of Histogram
ggplot(data=cricket,aes(x=Hundreds))+geom_freqpoly()

image

About

Visualization in R with R studio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published