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

Pubblicato il: 04 aprile 2023
sul canale di: 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


In questa pagina del sito puoi guardare il video online R ggplot2 Error: Continuous value supplied to discrete scale (2 Examples) | Wrong Grouping Variable della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Statistics Globe 04 aprile 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 824 volte e gli è piaciuto 12 spettatori. Buona visione!