This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
You can also embed plots, for example:
library(ggplot2)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(later)
library(gridExtra)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:gridExtra':
##
## combine
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
dfrNifty <- read.csv("C:/Users/admin/Desktop/Pooja p/R-Files1/nifty-data.csv", header=T, stringsAsFactors=F)
#Exercise 1:- Bar Graph showing Trades,TradeQty,TradeValues of first 15 records.
dfrNifty.Tmp <- dfrNifty[1:15,]#Slice/Filter for 15 records
View(dfrNifty.Tmp)
dfrNifty.Tmp <- select(dfrNifty.Tmp, Symbol, Trades,TradeQty,TradeValue)
dfrNifty.Tmp <- gather(dfrNifty.Tmp, Price, Value, -Symbol)
names(dfrNifty.Tmp) <- c("Symbol","Vars","Vals")
ggpGraph <-ggplot(dfrNifty.Tmp, aes(x=Symbol, y=Vals, fill=Vars)) +
geom_bar(stat="identity", position="dodge") +
labs(title="Bar Graph for First 15 Records") +
labs(x="Script Name") +
labs(y="Price") +
theme(legend.position="bottom") +
theme(axis.text.x=element_text(angle=50,hjust=1,vjust=1))
ggplotly(ggpGraph)
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.