Skip to content

Behaviour of quantile() #227

@GegznaV

Description

@GegznaV

Wouldn't it be more reasonable to create a new column in @data with quantiles instead of adding this info to row names, which is not so intuitive? Especially as the values in @data are set to NA.
Data in a column would be easier to access for plotting, etc.

suppressPackageStartupMessages(library(hyperSpec))

flu
#> hyperSpec object
#>    6 spectra
#>    3 data columns
#>    181 data points / spectrum
#> wavelength: lambda/nm [numeric] 405.0 405.5 ... 495 
#> data:  (6 rows x 3 columns)
#>    1. spc: I[fl]/"a.u." [matrix, array181] 27.15000 66.80133 ... 294.6495 
#>    2. filename: filename [character] rawdata/flu1.txt rawdata/flu2.txt ... rawdata/flu6.txt 
#>    3. c: c / (mg / l) [numeric] 0.05 0.10 ... 0.3

flu_pretty_quantiles <- quantile(flu, names = "pretty")

rownames(flu_pretty_quantiles)
#> [1] "  0 %" " 50 %" "100 %"

flu_pretty_quantiles$..
#>       filename  c
#>   0 %     <NA> NA
#>  50 %     <NA> NA
#> 100 %     <NA> NA

Created on 2020-07-26 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions