install.packages("tidyverse")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("lubridate")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("dplyr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("ggplot2")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("tidyr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("here")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("skimr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
install.packages("janitor")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
## (as 'lib' is unspecified)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.4
## ── 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
library(lubridate)
library(dplyr)
library(ggplot2)
library(tidyr)
library(here)
## here() starts at /cloud/project
library(skimr)
library(janitor)
##
## Attaching package: 'janitor'
##
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
summary(cruiseship)
## Ship_name Cruise_line Age Tonnage
## Length:158 Length:158 Min. : 4.00 Min. : 2.329
## Class :character Class :character 1st Qu.:10.00 1st Qu.: 46.013
## Mode :character Mode :character Median :14.00 Median : 71.899
## Mean :15.69 Mean : 71.285
## 3rd Qu.:20.00 3rd Qu.: 90.772
## Max. :48.00 Max. :220.000
## passengers length cabins passenger_density
## Min. : 0.66 Min. : 2.790 Min. : 0.330 Min. :17.70
## 1st Qu.:12.54 1st Qu.: 7.100 1st Qu.: 6.133 1st Qu.:34.57
## Median :19.50 Median : 8.555 Median : 9.570 Median :39.09
## Mean :18.46 Mean : 8.131 Mean : 8.830 Mean :39.90
## 3rd Qu.:24.84 3rd Qu.: 9.510 3rd Qu.:10.885 3rd Qu.:44.19
## Max. :54.00 Max. :11.820 Max. :27.000 Max. :71.43
## crew
## Min. : 0.590
## 1st Qu.: 5.480
## Median : 8.150
## Mean : 7.794
## 3rd Qu.: 9.990
## Max. :21.000
head(cruiseship)
## Ship_name Cruise_line Age Tonnage passengers length cabins
## 1 Journey Azamara 6 30.277 6.94 5.94 3.55
## 2 Quest Azamara 6 30.277 6.94 5.94 3.55
## 3 Celebration Carnival 26 47.262 14.86 7.22 7.43
## 4 Conquest Carnival 11 110.000 29.74 9.53 14.88
## 5 Destiny Carnival 17 101.353 26.42 8.92 13.21
## 6 Ecstasy Carnival 22 70.367 20.52 8.55 10.20
## passenger_density crew
## 1 42.64 3.55
## 2 42.64 3.55
## 3 31.80 6.70
## 4 36.99 19.10
## 5 38.36 10.00
## 6 34.29 9.20
colnames(cruiseship)
## [1] "Ship_name" "Cruise_line" "Age"
## [4] "Tonnage" "passengers" "length"
## [7] "cabins" "passenger_density" "crew"
str(cruiseship)
## 'data.frame': 158 obs. of 9 variables:
## $ Ship_name : chr "Journey" "Quest" "Celebration" "Conquest" ...
## $ Cruise_line : chr "Azamara" "Azamara" "Carnival" "Carnival" ...
## $ Age : int 6 6 26 11 17 22 15 23 19 6 ...
## $ Tonnage : num 30.3 30.3 47.3 110 101.4 ...
## $ passengers : num 6.94 6.94 14.86 29.74 26.42 ...
## $ length : num 5.94 5.94 7.22 9.53 8.92 8.55 8.55 8.55 8.55 9.51 ...
## $ cabins : num 3.55 3.55 7.43 14.88 13.21 ...
## $ passenger_density: num 42.6 42.6 31.8 37 38.4 ...
## $ crew : num 3.55 3.55 6.7 19.1 10 9.2 9.2 9.2 9.2 11.5 ...
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:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.