*Sai Chandana Kolli (s3642026)
library(xlsx)
## Loading required package: rJava
## Loading required package: xlsxjars
library(xml2)
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
packageVersion('plotly')
## [1] '4.7.1.9000'
library(readxl)
type1 <- read_excel("~/Desktop/type1.xlsx")
View(type1)
library(readxl)
death <- read_excel("~/Desktop/death.xlsx")
View(death)
library(readxl)
cancer <- read_excel("~/Desktop/cancer.xlsx")
View(cancer)
The story selected is about cigarette filters which is an engineering hoax that harms both smokers and the environment. This is taken from the following link: https://theconversation.com/filters-a-cigarette-engineering-hoax-that-harms-both-smokers-and-the-environment-85393
Around the world, women are more likely to smoke what they think are “light” (filtered) cigarettes. More Australian women die from lung cancer than from breast cancer. Although breast cancer is more common, it has a much higher survival rate than lung cancer.
In 2013, there were 124,465 new cases of cancer diagnosed in Australia (68,936 males and 55,529 females). In 2017, it is estimated that 134,174 new cases of cancer will be diagnosed in Australia (72,169 males and 62,005 females).
library(plotly)
type1 <- data.frame("Categorie"=type1$cancertype, type1)
data <- type1[,c('Categorie', 'newcases')]
colors <- c('rgb(211,94,96)', 'rgb(128,133,133)', 'rgb(144,103,167)', 'rgb(171,104,87)', 'rgb(114,147,203)')
p <- plot_ly(data, labels = ~Categorie, values = ~newcases, type = 'pie',
textposition = 'inside',
textinfo = 'label+percent',
insidetextfont = list(color = '#FFFFFF'),
hoverinfo = 'text',
text = ~paste(newcases),
marker = list(colors = colors,
line = list(color = '#FFFFFF', width = 1)),
showlegend = FALSE) %>%
layout(title = 'New Cases of Cancer in Australia 2017',
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
chart_link = api_create(p, filename="pig")
## Found a grid already named: 'pig Grid'. Since fileopt='overwrite', I'll try to update it
## Found a plot already named: 'pig'. Since fileopt='overwrite', I'll try to update it
chart_link
source: Australian Institute of Health and Welfare
https://canceraustralia.gov.au/affected-cancer/what-cancer/cancer-australia-statistics
In 2014, there were 44,171 deaths from cancer in Australia (24,718 males and 19,453 females). In 2017, it is estimated that this will increase to 47,753 deaths (27,076 males and 20,677 females).
library(plotly)
death<- data.frame("Categorie"=death$cancertype, death)
data <- death[,c('Categorie', 'deaths')]
colors <- c('rgb(211,94,96)', 'rgb(128,133,133)', 'rgb(144,103,167)', 'rgb(171,104,87)', 'rgb(114,147,203)')
p <- plot_ly(data, labels = ~Categorie, values = ~deaths, type = 'pie',
textposition = 'inside',
textinfo = 'label+percent',
insidetextfont = list(color = '#FFFFFF'),
hoverinfo = 'text',
text = ~paste(deaths),
marker = list(colors = colors,
line = list(color = '#FFFFFF', width = 1)),
showlegend = FALSE) %>%
layout(title = 'Death Cases of Cancer in Australia 2017',
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
chart_link = api_create(p, filename="pig1")
## Found a grid already named: 'pig1 Grid'. Since fileopt='overwrite', I'll try to update it
## Found a plot already named: 'pig1'. Since fileopt='overwrite', I'll try to update it
chart_link
source: Australian Institute of Health and Welfare
https://canceraustralia.gov.au/affected-cancer/what-cancer/cancer-australia-statistics
Around seven billion butts become litter in Australia every year. Filters are harmful to the environment, as they contain plastic and are not bio-degradable. Our urban environment, marine life, oceans, rivers and beaches would all benefit substantially from ending the sale of cigarettes with filters. Cigarette butts and other tobacco product waste (TPW) items comprises the largest percentage of waste (approximately 19 %–38 % of total waste products by count) collected globally during the coastal cleanups each year (See Ocean Conservancy Data for 2012) The percentage of damage caused due to cigarettes/filters is more when compared to other marine debris items.
p <-plot_ly(x=c("cigarettes/filters","food wrappers/containers","bottles(plastic","plastic bags","caps/lids","cups/plates","straws/stirrers","bottles(glass)", "beverage cans","papaer bags"),
y=c(19,10,10,9,9,6,6,5,3,3), name="filters effect on marine life", type="bar",
marker = list(color =c('rgba(222,45,38,0.8)',
'rgba(238,150,146,1)', 'rgba(238,150,146,1)', 'rgba(238,150,146,1)', 'rgba(238,150,146,1)', 'rgba(238,150,146,1)', 'rgba(238,150,146,1)', 'rgba(238,150,146,1)', 'rgba(238,150,146,1)', 'rgba(238,150,146,1)'))) %>% layout(title = "Most Harmful Factor", xaxis = list(title = "Items"), yaxis = list(title = "Percentage"))
username <- "chandanakollik"
apikey <- "6XJvEkh7HcQ8BxJo3IHl"
Sys.setenv("plotly_username"= username)
Sys.setenv("plotly_api_key"= apikey)
chart_link = api_create(p, filename="filters harm on marine life")
## Found a grid already named: 'filters harm on marine life Grid'. Since fileopt='overwrite', I'll try to update it
## Found a plot already named: 'filters harm on marine life'. Since fileopt='overwrite', I'll try to update it
chart_link
source: Curr Environ Health Rep.