```{r setup, include=FALSE}n knitr::opts_chunk$set(echo = TRUE)
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.2 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── 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(readxl)
library(janitor)
##
## Attaching package: 'janitor'
##
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(skimr)
df <- read_csv("R sheet - Sheet1.csv")
## Rows: 10 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (3): Leaf, Length, Width
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
df <- janitor::clean_names(df)
glimpse(df)
## Rows: 10
## Columns: 3
## $ leaf <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
## $ length <dbl> 4.5, 4.6, 4.3, 4.4, 4.8, 4.4, 4.5, 4.6, 4.4, 4.7
## $ width <dbl> 2.1, 2.2, 1.9, 2.2, 2.4, 2.1, 2.0, 2.3, 2.0, 2.2
head(df, 10)
## # A tibble: 10 × 3
## leaf length width
## <dbl> <dbl> <dbl>
## 1 1 4.5 2.1
## 2 2 4.6 2.2
## 3 3 4.3 1.9
## 4 4 4.4 2.2
## 5 5 4.8 2.4
## 6 6 4.4 2.1
## 7 7 4.5 2
## 8 8 4.6 2.3
## 9 9 4.4 2
## 10 10 4.7 2.2
ggplot(df, aes(x = length, y = width)) +
geom_point() +
labs(
title = "Leaf dimensions",
x = "Length (cm)",
y = "Width (cm)"
)
## R Markdown
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.