plot barchart by using R

A PHP Error was encountered

Severity: Warning

Message: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

Filename: blog/post_details.php

Line Number: 38

Backtrace:

File: /home/solutio1/public_html/application/views/blog/post_details.php
Line: 38
Function: strtotime

File: /home/solutio1/public_html/application/controllers/Blog.php
Line: 14
Function: view

File: /home/solutio1/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

Filename: blog/post_details.php

Line Number: 38

Backtrace:

File: /home/solutio1/public_html/application/views/blog/post_details.php
Line: 38
Function: date

File: /home/solutio1/public_html/application/controllers/Blog.php
Line: 14
Function: view

File: /home/solutio1/public_html/index.php
Line: 315
Function: require_once

2019-09-06
Manoj Pawar

Data outside of R environment can be read in R.We can read and write data into various file formats like csv,excel,xml etc.Csv file is comma separated values which is in text format. We can create csv file using windows notepad and save as .csv extension. Consider input file is book2.csv.  

> y<-read.csv("book2.csv")

> print(y)

  id    name      eye_color         X

1  1    a          red              m

2  2    b          blue             f

3  3    c          blue             f

4  4    d          red              f

5  5    e          blue             m

6  6    f          brown            m

Given table contain 6 rows and 4 columns, when we want to find how many color, name and gender present in the table then we have to follow following command.

> table(y$color)

  blue   brown    red

    3     1     2

> table(y$name)

    a b c d e f

    1 1 1 1 1 1

> table(y$sex)

    f m

    3 3

 

Following output will show how many color present in the table by using graphical representation.

  

> barplot(table(y$eye_color),xlab = "color",ylab = "frequency",main = "title")

where,

xlab:shows name on x-axis.

ylab:shows name on y-axis.

main:shows title of chart.

 

 

 

 


About author

Card image cap
Manoj Pawar

I am data analyst and show you how visualization done using R language.!

-Data Analyst

0 Comments