0% found this document useful (0 votes)
23 views

Line Chart - TRY This in R Studio

The document provides instructions for practicing statistical functions and plotting graphs in R. It includes examples of how to calculate the sum, mean, median, variance, and standard deviation of vectors. It also demonstrates how to create line charts to plot multiple variables against x, and a pie chart to visualize categorical data as percentages of a whole. Students are asked to try these functions and plots at home ahead of a class covering the material in more depth.

Uploaded by

Rohan Kashyap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Line Chart - TRY This in R Studio

The document provides instructions for practicing statistical functions and plotting graphs in R. It includes examples of how to calculate the sum, mean, median, variance, and standard deviation of vectors. It also demonstrates how to create line charts to plot multiple variables against x, and a pie chart to visualize categorical data as percentages of a whole. Students are asked to try these functions and plots at home ahead of a class covering the material in more depth.

Uploaded by

Rohan Kashyap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Dear all,

We will practice functions in Statistical area tomorrow and also draw plots. 

Try these at home:

var1= c(1:10)
> var1
 [1]  1  2  3  4  5  6  7  8  9 10
> sum(var1)
[1] 55
> mean(var1)
[1] 5.5
> var2= c(1:1000)
> sum(var2)
[1] 500500
> mean(var2)
[1] 500.5
> var3= sum(var2)-sum(var1)
> var3
[1] 500445

similarly try for median(), var() (variance), sd() std deviation, range.

We will try plots in the class. 


Line Chart - TRY this in R Studio
x= c(1,2,3,4,5)
y= c(10,11,13,14,15)
#Plot line chart
plot (x,y,type="o", col="red", xlab="Month", ylab="Sales", main = "Sales Trend")

Multiple state rain fall


x= c(1,2,3,4,5)
Goa= c(10,11,13,14,20)
Assam= c(12,13,15,13,20)
#Plot line chart
plot (x,Goa,type="o", col="red", xlab="Month", ylab="Sales", main = "Sales Trend")
lines(x,Assam,type="o", col="blue")
Pie Chart

expenditure = c(300,200,100)
expenditure
pie(expenditure,labels=c("food", "enter", "trans"), main = "Expenditure breakdown",
col=c("red", "orange", "green"), border ="brown", clockwise=TRUE)

You might also like