Исключение в конструкторе приложений javafx [дубликат]

Это работает для вас?

library(ggplot2)
library(data.table)

#generate some data
set.seed(123)
n=500
dat <- data.table(group=c("A","B"),value=rnorm(n))

ggplot по умолчанию определяет outlier как то, что составляет> 1.5 * IQR из границ поля.

#function that takes in vector of data and a coefficient,
#returns boolean vector if a certain point is an outlier or not
check_outlier <- function(v, coef=1.5){
  quantiles <- quantile(v,probs=c(0.25,0.75))
  IQR <- quantiles[2]-quantiles[1]
  res <- v < (quantiles[1]-coef*IQR)|v > (quantiles[2]+coef*IQR)
  return(res)
}

#apply this to our data
dat[,outlier:=check_outlier(value),by=group]
dat[,label:=ifelse(outlier,"label","")]

#plot
ggplot(dat,aes(x=group,y=value))+geom_boxplot()+geom_text(aes(label=label),hjust=-0.3)

1
задан halfer 30 January 2019 в 20:15
поделиться