Let’s generate R markdown
I am using tidyverse package to analyze the data.
Here are my R programming
There would be price, cut, color, and carat information.
```{r message=FALSE, warning=FALSE}
library(tidyverse)
diamonds %>%
select(price, cut, color, carat) %>%
head(10)
```
For data visualization, I am going to build a histogram price chart
```{r message=FALSE, warning=FALSE}
mini_dia <- sample_n(diamonds, 3000)
ggplot(data = mini_dia,
mapping = aes(x=price)) +
geom_histogram() +
theme_minimal()
```
Add a Price x carat chart
```{r message=FALSE, warning=FALSE}
mini_dia <- sample_n(diamonds, 3000)
ggplot(mini_dia, aes(x = price, y=carat)) +
geom_point(color="gold") +
geom_smooth() +
theme_minimal()
```
Add a sample of distribution
```{r message=FALSE, warning=FALSE}
mini_dia <- sample_n(diamonds, 3000)
ggplot(data = mini_dia,
mapping = aes(x=cut, y=price, fill=cut)) +
geom_violin() +
theme_minimal()
```
The result is here.
All code for your reference.
---
title: "My R Markdown report"
author: "AP"
date: "2025-10-26"
output:
pdf_document: default
html_document: default
---
## Data analysis using tidyverse package
Today I will use R to manupulate data and `package` to do all the work.
```{r message=FALSE, warning=FALSE}
library(tidyverse)
diamonds %>%
select(price, cut, color, carat) %>%
head(10)
```
##A histogram price chart
```{r message=FALSE, warning=FALSE}
mini_dia <- sample_n(diamonds, 3000)
ggplot(data = mini_dia,
mapping = aes(x=price)) +
geom_histogram() +
theme_minimal()
```
## sample price x carat
```{r message=FALSE, warning=FALSE}
mini_dia <- sample_n(diamonds, 3000)
ggplot(mini_dia, aes(x = price, y=carat)) +
geom_point(color="gold") +
geom_smooth() +
theme_minimal()
```
## sample of distribution
```{r message=FALSE, warning=FALSE}
mini_dia <- sample_n(diamonds, 3000)
ggplot(data = mini_dia,
mapping = aes(x=cut, y=price, fill=cut)) +
geom_violin() +
theme_minimal()
```
--THIS IS THE END OF THE REPORT--
Thank you.
