Extract statistics from boxplot

前端 未结 2 1152
余生分开走
余生分开走 2020-12-21 14:48

I\'ve already tried searching but I\'ve found nothing similar. I have a dataset containing temperatures, and another dataset containing 23 tipes of terrain (categorical vari

2条回答
  •  抹茶落季
    2020-12-21 15:07

    From boxplot help:

    Value

    List with the following components:

    stats
    a matrix, each column contains the extreme of the lower whisker, the lower hinge, the median, the upper hinge and the extreme of the upper whisker for one group/plot. If all the inputs have the same class attribute, so will this component.

    n
    a vector with the number of observations in each group.

    conf
    a matrix where each column contains the lower and upper extremes of the notch.

    out
    the values of any data points which lie beyond the extremes of the whiskers.

    group
    a vector of the same length as out whose elements indicate to which group the outlier belongs.

    names
    a vector of names for the groups.

    So in your case, you can get the medians of the different categories this way:

    # drawing the boxplots and assigning the results to an object
    bp<-boxplot(zone$tm_03 ~ ds3_utm$terr, col='chartreuse3', xlab='Terreno', ylab='Temperatura (°C)', varwidth=T)
    # get the different medians, which are on the 3rd row of the stats element
    bp$stats[3,]
    

提交回复
热议问题