R ggplot2 Error: Continuous value supplied to discrete scale (2 Examples) | Wrong Grouping Variable

Veröffentlicht am: 04 April 2023
auf dem Kanal: Statistics Globe
824
12

How to handle the “Error: Continuous value supplied to discrete scale” in the R programming language. More details: https://statisticsglobe.com/r-error-c...
R code of this video:

set.seed(834759) # Create example data
data <- data.frame(x = rnorm(100),
group = 1:5)
head(data) # Head of example data

install.packages("ggplot2") # Install & load ggplot2 package
library("ggplot2")

ggplot(data, aes(x, group = group, fill = group)) + # Try to modify colors
geom_boxplot() +
scale_fill_manual(values = c("red", "yellow",
"blue", "orange",
"green"))

ggplot(data, aes(x, group = group, fill = factor(group))) + # Properly adding colors
geom_boxplot() +
scale_fill_manual(values = c("red", "yellow",
"blue", "orange",
"green"))

Follow me on Social Media:
Facebook – Statistics Globe Page:   / statisticsglobecom  
Facebook – R Programming Group for Discussions & Questions:   / statisticsglobe  
Facebook – Python Programming Group for Discussions & Questions:   / statisticsglobepython  
LinkedIn – Statistics Globe Page:   / statisticsglobe  
LinkedIn – R Programming Group for Discussions & Questions:   / 12555223  
LinkedIn – Python Programming Group for Discussions & Questions:   / 12673534  
Twitter:   / joachimschork  

Music by bensound.com


Auf dieser Seite können Sie das Online-Video R ggplot2 Error: Continuous value supplied to discrete scale (2 Examples) | Wrong Grouping Variable mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Statistics Globe 04 April 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 824 Mal angesehen und es wurde von 12 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!