Hello my friends,
I have read same question that have been asked by other members. But unfortunately I could not find a solution to my problem. i have written some code to draw a graph and R showed the Fehler: Aesthetics must be either length 1 or the same as the data (50): y
My Codes are:
Code 1.
ifr_for_all <- (service[service$service == "Warehousing", ]$QExecuted / service[service$service == "Warehousing", ]$QScheduled)
error_for_all <- cbind(service [service$service == "Warehousing", ], ifr_for_all)
kpi_warehousing_for_all <-
cbind(sort(unique(error_for_all$vendor)), aggregate(QExecuted ~ vendor + Year, data = error_for_all, sum)[2],
(aggregate(QExecuted ~ vendor + Year, data = error_for_all, sum)[3])/(aggregate(QScheduled ~ vendor + Year, data = error_for_all, sum)[3]))
colnames(kpi_warehousing_for_all) <- c("vendor", "Year" , " IFR ")
kpi_warehousing_for_all
ggplot(kpi_warehousing_for_all, aes(Year, ifr, group = vendor, color= vendor)) + geom_point() + geom_line()
Code 2
kpi_warehousing_perRegion <-
cbind(sort(unique(error_for_all$vendor)), aggregate(QExecuted ~ vendor + region, data = error_for_all, sum)[2],
(aggregate(QExecuted ~ vendor + region, data = error_for_all, sum)[3])/(aggregate(QScheduled ~ vendor + region, data = error_for_all, sum)[3]))
colnames(kpi_warehousing_perRegion) <- c("vendor", "region", " IFR ")
kpi_warehousing_perRegion
ggplot(kpi_warehousing_perRegion, aes(region, ifr_for_all, group = vendor, color= vendor, fill = vendor)) + geom_bar(stat = "identity", position ="dodge") + scale_fill_brewer(palette = "Paired") + scale_color_brewer(palette = "Paired") + coord_cartesian(ylim = c(0.1, 0.215))
If you help me to solve thoes problems, I will be greatful