Chaithra
March 15, 26
Buying a diamond is a major investment. This application helps users:
diamonds dataset for accuracy.We utilize the ggplot2 diamonds dataset, which contains prices and attributes for over 50,000 diamonds.
# This is an evaluated R expression
library(ggplot2)
summary(diamonds$price)
Min. 1st Qu. Median Mean 3rd Qu. Max.
326 950 2401 3933 5324 18823
# This code runs but the code itself is hidden (echo=FALSE)
plot(diamonds$carat, diamonds$price, col="blue",
xlab="Carat", ylab="Price ($)", main="Price vs Carat")
plot(diamonds$carat, diamonds$price, col="blue",
xlab="Carat", ylab="Price ($)", main="Price vs Carat")
abline(lm(price ~ carat, data=diamonds), col="red", lwd=3)
The application is built with Shiny Reactivity, meaning: The server recalculates the model instantly when you move the slider. No “Submit” button is required; the UI updates in real-time. The plot highlights exactly where your selected diamond sits compared to the rest of the data.