%>% symbol, output from one command can be sent to another.
For example if
salesdata is a data.frame, the
head command selects the first 5 rows. Thus the command
salesdata <- data.frame(xxx) head(salesdata)
prints the first five lines on the screen. The same command can be written as
salesdata <- data.frame(xxx) salesdata %>% head()
This different way of writing, piping the results to the head command is useful when many processing steps are to be taken.
The following code creates the salesdata data.frame. The date and product columns are then selected. The data is then sorted by date and the resultant new dataset is stored in proddata.
salesdata <- data.frame(xxx) salesdata %>% select(date, product) %>% arrange(date) -> proddata
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.