An intro to the world of R:
R is an open source programming language and software environment for statistical computing and graphics. The R language is widely used among statisticians and data miners for developing statistical software and data analysis.R provides a wide variety of statistical and graphical techniques, including linear and nonlinear modeling, classical statistical tests, time-series analysis, classification, clustering, and others. R is easily extensible through functions and extensions, and the R community is noted for its active contributions in terms of packages. There are some important differences, but much code written for S runs unaltered. Many of R's standard functions are written in R itself, which makes it easy for users to follow the algorithmic choices made.
Assignment 1:
Draw a histogram after concatenating 3 data points.
Reading from the csv file is done as under -:
This command prompts the user to select the data file from the saved location.
zcol1 be the variable that contains contents of column 3 from the excel data.
the following commands were used.
> zcol1<-z[,3]
> plot(zcol1 , type="b" , main="NSE Graph" , xlab="Time" , ylab="indices")
Min. 1st Qu. Median Mean 3rd Qu. Max.
4888 5660 5723 5758 5884 6021
> range(y)
will give the desired range of volatility
[1] 4888.20 6020.75
R is an open source programming language and software environment for statistical computing and graphics. The R language is widely used among statisticians and data miners for developing statistical software and data analysis.R provides a wide variety of statistical and graphical techniques, including linear and nonlinear modeling, classical statistical tests, time-series analysis, classification, clustering, and others. R is easily extensible through functions and extensions, and the R community is noted for its active contributions in terms of packages. There are some important differences, but much code written for S runs unaltered. Many of R's standard functions are written in R itself, which makes it easy for users to follow the algorithmic choices made.
Assignment 1:
Draw a histogram after concatenating 3 data points.
Soln :
Commands used are as under -:
> x<-c(1,2,3)
> plot(x, type = "h")
Histogram
Assignment 2: Drawing a line graph with points and naming the graph and the axis.
Soln : Let z be the variable that contains data from the .csv file selected.Reading from the csv file is done as under -:
> z<-read.csv(file.choose(), header=T)
zcol1 be the variable that contains contents of column 3 from the excel data.
the following commands were used.
> zcol1<-z[,3]
> plot(zcol1 , type="b" , main="NSE Graph" , xlab="Time" , ylab="indices")
Assignment 3:
Create a scatter plot by using share HIGH and LOW values from the NSE Historical data as obtained from the .csv file.
Soln :
HIGH values as obtained in previous ques
> zcol1<-z[,3]
LOW values are in column 4 from the csv file
> zcol2<-z[,4]
To plot the scatter plot
> plot(zcol1,zcol2)
Assignment 4 :
To find the volatility between the share values obtained from NSE historical data and obtain the range for the same.
Soln :-
To obtain the volatility , we wold require the maximum value amongst the
HIGH values and the minimum values amongst the LOW values.
Merging both the columns into one vector variable 'y' to get the HIGH and LOW values together.
> y<-c(zcol1,zcol2)
> summary(y)
will give the min and the max value as under -:
4888 5660 5723 5758 5884 6021
> range(y)
will give the desired range of volatility
[1] 4888.20 6020.75
Assignment 5:
To create a matrix.
Soln:





No comments:
Post a Comment