IT Business Application Lab :Assignment 1
Assignment 1:
Draw a histogram concatenating 3 data points.
Solution:
>x<-c(1,2,3)
>plot(x,type="h")
Output :
Assignment 2:
Drawing a line graph with points and naming the graph and the axis.
Solution:
Step 1:
Let z be the variable that contains data from the .csv file selected.
Reading from the csv file
> z<-read.csv(file.choose(), header=T)
This command asks the user to select the file from the saved location.
Step 2:
Let, zcol1 be the variable that contains contents of column 3 and all rows from the excel datasheet.
> zcol1<-z[,3]
Assignment 3:
Create a scatter plot by using share HIGH and LOW values from the NSE Historical data as obtained from the .csv file.
Solution :
HIGH values are obtained from column 3 from the csv file
> zcol1<-z[,3]
LOW values are obtained from column 4 from the csv file
> zcol2<-z[,4]
Now,To plot the scatter plot
> plot(zcol1,zcol2)
Output:
Assignment 4:
To find the volatility between the share values obtained from NSE historical data and obtain the range for the same.
Solution :-
To obtain the volatility , we require the highest value in the HIGH values column and the lowest value among the LOW values column.
Merging both the columns into one vector variable 'y' to get the HIGH and LOW values together can be done by using the following command:
> y<-c(zcol1,zcol2)
> summary(y)
Min. 1st Qu. Median Mean 3rd Qu. Max.
4888 5660 5723 5758 5884 6021
Now as we have got the max and min values we can find the range hence the required volatility.
> range(y)
[1] 4888.20 6020.75
Output:
Assignment 1:
Draw a histogram concatenating 3 data points.
Solution:
>x<-c(1,2,3)
>plot(x,type="h")
Output :
Assignment 2:
Drawing a line graph with points and naming the graph and the axis.
Solution:
Step 1:
Let z be the variable that contains data from the .csv file selected.
Reading from the csv file
> z<-read.csv(file.choose(), header=T)
This command asks the user to select the file from the saved location.
Step 2:
Let, zcol1 be the variable that contains contents of column 3 and all rows from the excel datasheet.
> zcol1<-z[,3]
>
plot(zcol1 , type="b" , main="NSE Graph" ,
xlab="Time" , ylab="indices")
Output:
Output:
Assignment 3:
Create a scatter plot by using share HIGH and LOW values from the NSE Historical data as obtained from the .csv file.
Solution :
HIGH values are obtained from column 3 from the csv file
> zcol1<-z[,3]
LOW values are obtained from column 4 from the csv file
> zcol2<-z[,4]
Now,To plot the scatter plot
> plot(zcol1,zcol2)
Output:
Assignment 4:
To find the volatility between the share values obtained from NSE historical data and obtain the range for the same.
Solution :-
To obtain the volatility , we require the highest value in the HIGH values column and the lowest value among the LOW values column.
Merging both the columns into one vector variable 'y' to get the HIGH and LOW values together can be done by using the following command:
> y<-c(zcol1,zcol2)
> summary(y)
Min. 1st Qu. Median Mean 3rd Qu. Max.
4888 5660 5723 5758 5884 6021
Now as we have got the max and min values we can find the range hence the required volatility.
> range(y)
[1] 4888.20 6020.75
Output:
No comments:
Post a Comment