Description on the trelliscope graph: The data set that was used was the taxi data set. The data set shows the trip duration, total amount, and tip amount for a given time. This data is also presented on a daily basis with indication if the day is a weekend or weekday. I also chose to use filter the data set to show the most valuable data, and ignore the out liers. I also filtered on “Card” payment types. This is the most used paymnet type and would give me the most usable data for my investigations. The cognostic measure variable that I created was the tip percentage. I chose to facet on the day of the week, to determine if there was a coreleation between the day of the week and the tip percentage. I also wanted to see if trip duration had any impact the of the tip percentage. It was interesting to see that the shorter the trip, the higher percentage of tip amount. There also was no clear day of the week that had the highest tip percentage. I would have expected that the weekends have the higher percentage.
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(trelliscopejs)
## Warning: package 'trelliscopejs' was built under R version 4.3.3
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.3.3
## Warning: package 'tidyr' was built under R version 4.3.3
## Warning: package 'readr' was built under R version 4.3.3
## Warning: package 'purrr' was built under R version 4.3.3
## Warning: package 'stringr' was built under R version 4.3.3
## Warning: package 'forcats' was built under R version 4.3.3
## Warning: package 'lubridate' was built under R version 4.3.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ lubridate 1.9.3 ✔ tibble 3.2.1
## ✔ purrr 1.0.2 ✔ tidyr 1.3.1
## ✔ readr 2.1.5
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
tx <- read.csv(file = "tx.csv")
tx <- as_tibble(tx)
prcnt_tip <- tx %>%
filter(tip_amount< 12, trip_duration > 0, trip_duration < 60, payment_type == "Card") %>%
mutate(prct_tip = tip_amount/total_amount*(100))
prcnt_tip$prct_tip <- cog(prcnt_tip$prct_tip, desc = "Tip Percentage")
ggplot(prcnt_tip, aes(x = trip_duration, y = prct_tip, color = payment_type))+
geom_point()+
facet_trelliscope(~ pick_dow,
name = "Tip Percent vs Trip Duration",
desc = "Does the day of the week impact tip percent",
nrow = 2,
ncol = 3,
scales = c("same", "same"),
path = ".",
self_contained = TRUE)
## using data from the first layer
## Removing the following cognostics that are all NA: pick_wkday
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).