/ Python And R Data science skills: 21 ggplot visuvalization in r language Telugu

Sunday 22 April 2018

21 ggplot visuvalization in r language Telugu

-----------------------------------------------------
movie<-read.csv("Movie-Ratings.csv")
movie
head(movie)
colnames(movie)
colnames(movie)<-c("Film","Genre","CriRating","AudRatining","BMill","Year")
head(movie)
tail(movie)
str(movie)
summary(movie)
#convert year to factor
factor(movie$Year)
movie$Year<-factor(movie$Year)
head(movie)
summary(movie)
library(ggplot2)
ggplot(data=movie,aes(x=CriRating,y=AudRatining))
ggplot(data=movie,
       aes(x=CriRating,y=AudRatining)) +
  geom_point()
#add color
ggplot(data=movie,
       aes(x=CriRating,y=AudRatining,color=Genre)) +
  geom_point()
#size
ggplot(data=movie,
       aes(x=CriRating,y=AudRatining,color=Genre,
           size=Genre)) +
  geom_point()
#size
ggplot(data=movie,
       aes(x=CriRating,y=AudRatining,color=Genre,
           size=BMill)) +
  geom_point()



1 comment:

  1. In case the file is not CSV extension but .XLS how to import the file in "R".
    Why is it always .CSV file that is mentioned in examples??

    ReplyDelete