Ich bin ein total R noob Lernggplot. Ich verstehe nicht, warum der erste Ausschnitt funktioniert, während der zweite nicht funktioniert. Ich wollte eine gute binwidth finden, ohne zu raten, also habe ich ein Experiment versucht, das nicht funktioniert hat.Wie man Histogramm-Binbreite dynamisch einstellt
library(ggplot2)
attach(diamonds)
d <- diamonds
x <- ggplot(d, aes(x = price))
x <- x + geom_histogram(binwidth = 50)
x
# worked fine, but using the sequence and substituting i didn't
i <- seq(1, 101, by = 10) #tried to avoid the first arg as zero, but didn't work
x <- ggplot(d, aes(x = price))
x <- x + geom_histogram(binwidth = i)
x
zweiten wirft einen Fehler
Error in seq.default(round_any(range[1], size, floor), round_any(range[2], :
'from' must be of length 1
Error in exists(name, envir = env, mode = mode) :
argument "env" is missing, with no default
Ich verstehe nicht, was es will. Vielen Dank
Sie müssen 'lapply' verwenden. – Metrics