Skip to content

Binning + converting to wide-format dataset should not change colnames so drastically #237

Closed

Description

@GegznaV

In this situation, I expect the names to be identical. But currently, the information on wavelengths seems to be lost.

suppressPackageStartupMessages(library(hyperSpec))

# Should not change the names of wavelengths
flu_binned <- spc.bin(flu, 1)
# Let's see, that wavelengths are identical
(wl_regular <- wl(flu)[1:10])
#>  [1] 405.0 405.5 406.0 406.5 407.0 407.5 408.0 408.5 409.0 409.5

(wl_binned  <- wl(flu_binned)[1:10])
#>  [1] 405.0 405.5 406.0 406.5 407.0 407.5 408.0 408.5 409.0 409.5

all.equal(wl_regular, wl_binned)
#> [1] TRUE
# I expect the column names in wide-format dataset 
# to be identical too. But they are not!
(names_regular <- names(as.wide.df(flu))[1:10])
#>  [1] "405"   "405.5" "406"   "406.5" "407"   "407.5" "408"   "408.5" "409"  
#> [10] "409.5"

(names_binned  <- names(as.wide.df(flu_binned))[1:10])
#>  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10"

all.equal(names_regular, names_binned)
#> [1] "10 string mismatches"

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

Possibly related: #232

Activity

  1. added
    Type: possibly bug ❓
    on Jul 29, 2020
  2. added
    Type: bug 💣
    and removed
    Type: possibly bug ❓
    on Jul 29, 2020
  3. cbeleites commented on Jul 29, 2020

    @cbeleites
    Owner

    The issue is really that

    colnames(spc.bin(flu, 1)$spc)[1:10]
    #>  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10"
    

    Instead of strings with the wavelength.

  4. cbeleites commented on Jul 29, 2020

    @cbeleites
    Owner

    @GegznaV could you please take care of this?

  5. GegznaV commented on Jul 29, 2020

    @GegznaV
    CollaboratorAuthor

    OK.

  6. cbeleites commented on Jul 29, 2020

    @cbeleites
    Owner

    Thank you!

  7. changed the title [-]Binning + converting to wide-format dataset should chande colnames so drastically[/-] [+]Binning + converting to wide-format dataset should change colnames so drastically[/+] on Jul 30, 2020
  8. changed the title [-]Binning + converting to wide-format dataset should change colnames so drastically[/-] [+]Binning + converting to wide-format dataset should not change colnames so drastically[/+] on Jul 30, 2020
  9. added a commit that references this issue on Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type: bug 💣

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions