For R to rotate axis labels, one usually uses the las argument in the plotting functions, or the theme function in case you are working in ggplot2. Some examples come in both base R and ggplot2 below.
Base R
Use of las argument in plot()
las = 1 gives horizontal text
las = 2 gives vertical text
las = 3 makes it perpendicular to the axis
a <- 1:10
b <- rnorm(10)
# Basic plot with rotated y-axis labels
plot(a, b, ylab = "Values", las = 2) # Rotate y-axis labels
ggplot2
In ggplot2, you can utilize the theme() function in order to change the angle of the axis labels:
library(ggplot2)
# Sample data
df <- data.frame(a = 1:10, b = rnorm(10))
# Basic ggplot with rotated x-axis labels
ggplot(df, aes(a, b)) +
geom_point() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))