Repository navigation
Open
Labels
Type: possibly bug ❓Seems like a bug but needs conformation if it really is
Description
Documentation says:
x$.. <-Sets the extra data (x@datawithout touchingx$spc). The column names must match exactly in this case.
But $..<- behaves in an unexpected way. (See comment in code):
suppressPackageStartupMessages(library(hyperSpec))
flu$..
#> filename c
#> 1 rawdata/flu1.txt 0.05
#> 2 rawdata/flu2.txt 0.10
#> 3 rawdata/flu3.txt 0.15
#> 4 rawdata/flu4.txt 0.20
#> 5 rawdata/flu5.txt 0.25
#> 6 rawdata/flu6.txt 0.30# I expect either a warning or an error here,
# Or, better, that all data in @data (except column "spc") is replaced with the
# the replacement data.
#
# I do not expect that all columns get replaced with the same values
# (but old column names will remain)
spc <- flu
spc$.. <- data.frame(a = 1:6)
spc$..
#> filename c
#> 1 1 1
#> 2 2 2
#> 3 3 3
#> 4 4 4
#> 5 5 5
#> 6 6 6# The warning here is not informative or even misleading.
# I'd prefer no warnings.
#
# I expect correct replacement and not everything replaced with the same values
# of the first column in the replacement dataset.
spc <- flu
spc$.. <- data.frame(c = 1:6, filename = letters[1:6])
#> Warning in x@label[i] <- label: number of items to replace is not a multiple of
#> replacement length
spc$..
#> filename c
#> 1 1 1
#> 2 2 2
#> 3 3 3
#> 4 4 4
#> 5 5 5
#> 6 6 6
spc <- flu
spc$.. <- data.frame(filename = letters[1:6], c = 1:6)
#> Warning in x@label[i] <- label: number of items to replace is not a multiple of
#> replacement length
spc$..
#> filename c
#> 1 a a
#> 2 b b
#> 3 c c
#> 4 d d
#> 5 e e
#> 6 f fCreated on 2020-07-26 by the reprex package (v0.3.0)
Metadata
Metadata
Assignees
Labels
Type: possibly bug ❓Seems like a bug but needs conformation if it really is
Activity
cbeleites commentedon Jul 27, 2020
@GegznaV please do not use the label "bug" before there is confirmation that the issue is indeed a bug.
I'll check this (but not sure whether this week) and if I can confirm this is not as it should be, I'll label it "bug" again
GegznaV commentedon Jul 27, 2020
OK.
GegznaV commentedon Jul 29, 2020
Then I'll use a new tag
possibly buguntill it is confirmed or dimissed.