R Software: Assignment

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

R SOFTWARE

Assignment

Student Name :- Khagesh Vahan Yadav


Roll No :- 1520
Course :- BSc. Physical Science
with Electronics
Semester :- 6th
Teacher :- Mr. Prem raj Sir
HISTOGRAMS

> data2 # To obtain the data.


[1] 3 5 7 5 3 2 6 8 5 6 9 4 5 7 3 4

> hist(data2) # To obtain Histogram of any data.

> table(data2) # To obtain data in tabular form.

data2
2 3 4 5 6 7 8 9
1 3 2 4 2 2 1 1
# breaks = instruction, to
alter the numbering of columns.

>hist(data2, breaks = ‘Sturges’) # By default numbering of columns.


>hist(data2, breaks = 'st')
> hist(data2, breaks = 'Scott')
> hist(data2, breaks = 'sc') # to change the column alignment.
> hist(data2, breaks = 'FD')
> hist(data2, breaks = 'fr')

> hist(data2, breaks = 7)


> hist(data2, breaks = 2:9)
> hist(data2, breaks = c(2,3,4,5,6,7,8,9))

> hist(data2, breaks = c(2,4,5,6,9))


❖ Some basic syntax commands for histogram:

• col = 'color' # The color of the bars; a color name in quotes


(use colors()to see the range available).

• main = 'main.title' # A main title for the histogram; use NULL to suppress this.

• xlab = 'x.title' # A title for the x- axis.

• ylab = 'y.title' # A title for the y-axis.

• xlim = c(start, end) # The range for the x-axis; put numerical
values for the start and end points.

• ylim = c(start, end) # The range for the y-axis.

>hist(data2, col='green', main=NULL, xlab = 'Size class for data2',ylim= c(0,


0.3), freq = FALSE)

You might also like