I'm new to R programming can someone help with fix this problem,
for both scatterplot and histogram my class column has only 1,0 values but get output on my plot as 0.1,0.2...1.0
options(scipen = 999)
pdf("visualization.pdf")
# install.packages("scales")
# Scatter plot
library(tidyverse)
dataset <- read.csv("creditcard.csv")
amount <- dataset$Amount
class <- dataset$Class
plot(amount, class,
     main = "correlation between the amount of transaction and\n
     the occurrence of credit card fraud",
     xlab = "Amount", ylab = "Class",
     ylim = c(0, 3),
     pch = 19, frame = T
)
m <- lm(class ~ amount, data = dataset)
abline(m, col = "green")
# histogram
h <- hist(class,
     6,
     main = "",
     xlim = c(0, 3),
     ylab = "Amount",
     xlab = "Class",
     col = "red"
)
amount <- seq(min(class), max(class), 1)
Mn <- mean(class)
StdD <- sd(class)
y1 <- dnorm(amount, mean = Mn, sd = StdD)
y1 <- y1 * diff(h$mid[1:2] * length(class))
lines(amount, y1, col = "blue")
dev.off()
On my y-axis I only need to show 0 and 1, I tried using
scale_y_continuous(breaks= pretty_breaks())
but haven't solved my problem as it was giving errors
