4. Texts demo
• Data science is an interdisciplinary field about processes and
systems to extract knowledge or insights from data in various
forms, either structured or unstructured, which is a
continuation of some of the data analysis fields such as
statistics, machine learning, data mining, and predictive
analytics.
• Analytics is the discovery, interpretation, and communication
of meaningful patterns in data. Especially valuable in areas
rich with recorded information, analytics relies on the
simultaneous application of statistics, computer
programming and operations research to quantify
performance. Analytics often favors data visualization to
communicate insight.
• Machine learning is a type of artificial intelligence (AI) that
provides computers with the ability to learn without being
explicitly programmed. Machine learning focuses on the
development of computer programs that can teach
themselves to grow and change when exposed to new data.
• Data Science and Analytics
• Mathematics and Machine Learning, R, programming
5. R- Codes:
library(ReporteRs)
require(ggplot2)
require( magrittr )
mydoc <- pptx( title = "prepared by Volkan OBAN" )
# Add a Title slide ------------------
mydoc <- mydoc %>%
addSlide( slide.layout = "Title Slide" ) %>%
addTitle( "prepared by Volkan OBAN" ) %>% #set the main title
addSubtitle( "This document is generated with ReporteRs.") #set the sub-title
# plot demo ------------------
ploot<-ggplot(nmmaps, aes(x=date, y=o3))+geom_line(aes(color="Important line"))+ geom_point(aes(color="Point values"))+
scale_colour_manual(name='', values=c('Important line'='grey', 'Point values'='red'))
mydoc <- mydoc %>%
addSlide( slide.layout = "Title and Content" ) %>%
addTitle( "Plot examples" ) %>%
addPlot( function( ) print( ploot ) ) %>%
addPageNumber() %>%
addDate( ) %>%
addFooter( "Modify the graph within PowerPoint")
6. # FlexTable demo ----------------------
options( "ReporteRs-fontsize" = 12 )
# Create a FlexTable with data.frame mtcars, display rownames
# use different formatting properties for header and body cells
MyFTable <- FlexTable( data = iris[1:15,], add.rownames = TRUE,
body.cell.props = cellProperties( border.color = "#EDBD3E"),
header.cell.props = cellProperties( background.color = "#5B7778" )
) %>%
setZebraStyle( odd = "#DDDDDD", even = "#FFFFFF" ) %>% # zebra stripes - alternate colored backgrounds on table rows
setFlexTableWidths( widths = c(2, rep(.7, 11)) ) %>%
setFlexTableBorders( inner.vertical = borderProperties( color="#EDBD3E", style="dotted" ),
inner.horizontal = borderProperties( color = "#EDBD3E", style = "none" ),
outer.vertical = borderProperties( color = "#EDBD3E", style = "solid" ),
outer.horizontal = borderProperties( color = "#EDBD3E", style = "solid" )
) # applies a border grid on table
mydoc <- mydoc %>%
addSlide( slide.layout = "Title and Content" ) %>%
addTitle( "FlexTable example" ) %>%
addFlexTable( MyFTable )
# Text demo ----------------------------
# set default font size to 26
options( "ReporteRs-fontsize" = 26 )
texts = c( "Data science is an interdisciplinary field about processes and systems to extract knowledge or insights from data in various forms, either structured or unstructured, which is a continuation of
some of the data analysis fields such as statistics, machine learning, data mining, and predictive analytics.",
7. "Analytics is the discovery, interpretation, and communication of meaningful patterns in data. Especially valuable in areas rich with recorded information, analytics relies on the simultaneous application
of statistics, computer programming and operations research to quantify performance. Analytics often favors data visualization to communicate insight.",
"Machine learning is a type of artificial intelligence (AI) that provides computers with the ability to learn without being explicitly programmed. Machine learning focuses on the development of
computer programs that can teach themselves to grow and change when exposed to new data." )
# format some of the pieces of text
pot1 = pot("Data Science" , textProperties(color="red" ) ) + " and " + pot("Analytics", textProperties(font.weight="bold") )
pot2 = pot("Mathematics", textProperties(color="red" ) ) + " and " + pot("Machine Learning, R, programming", textProperties(color="blue" ) )
mydoc <- mydoc %>%
addSlide( slide.layout = "Two Content" ) %>%
addTitle( "Texts demo" ) %>%
addParagraph( value = texts ) %>%
addParagraph( set_of_paragraphs( pot1, pot2 ) )
writeDoc( mydoc, file = "vdemo.pptx" )