You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please see the MRE below. patterns() returns the matched positions of input cols, which are 1 and 2, resulting using id_1 and id_2 as the measure.vars:
library(data.table)
dt<- data.table(
id_1=1:3,
id_2=letters[1:3],
letter_1=LETTERS[1:3],
letter_2=LETTERS[4:6]
)
melt(dt, measure.vars= patterns("_\\d$", cols= paste0("letter_", 1:2)))
#> Warning in melt.data.table(dt, measure.vars = patterns("_\\d$", cols =#> paste0("letter_", : 'measure.vars' [id_1, id_2] are not all of the same type.#> By order of hierarchy, the molten data value column will be of type#> 'character'. All measure variables not of type 'character' will be coerced too.#> Check DETAILS in ?melt.data.table for more on coercion.#> letter_1 letter_2 variable value#> <char> <char> <fctr> <char>#> 1: A D id_1 1#> 2: B E id_1 2#> 3: C F id_1 3#> 4: A D id_2 a#> 5: B E id_2 b#> 6: C F id_2 c
The text was updated successfully, but these errors were encountered:
hongyuanjia
changed the title
patterns() did not consider the position of cols provided in the original DTpatterns() did not consider the position of provided cols in the original DT
Sep 15, 2024
Please see the MRE below.
patterns()
returns the matched positions of inputcols,
which are1
and2
, resulting usingid_1
andid_2
as themeasure.vars
:The text was updated successfully, but these errors were encountered: