Skip to content

Extension of createNotes() to work with levels specified by seperators #40

@panoptikum

Description

@panoptikum

Hello,

sorry for my novice behaviour regarding pull requests and so on.

I'm opening an issue for this as I've announced:

It would be great if nodes could be specified by a separator such as an underscore.

This way the function could handle different length of nodes names.

My current solution looks for hts.R can be found in my fork repo. This time I only use function from base R:

panoptikum@1d1ee22

I've tested with the examples:

abc <- ts(5 + matrix(sort(rnorm(1000)), ncol = 10, nrow = 100))
colnames(abc) <- c("AA_100_A_172", "AA_100_A_172", "A_10_C_A", "A_2_B_21", "A_2_B_DA","B30_A_1_H", "B30_B_3_Z", "B30_B_1_%", "B_40_A_2", "B_40_A_3")
y <- hts(abc, characters = c(1, 2, 1), sep="_")

and

abc <- ts(5 + matrix(sort(rnorm(1000)), ncol = 10, nrow = 100))
colnames(abc) <- c("AA_100_A", "AA_10_B1Z2", "A_10_C", "A_2_AB", "A_2_B","B30_A_1", "B30_B_3", "B30_CA_1", "B_40_A", "B_40_B")
y <- hts(abc, characters = c(1, 2, 1), sep="_")

gave me for y$nodes:

$`Level 1`
[1] 4

$`Level 2`
 AA   A B30   B 
  2   3   3   2 

$`Level 3`
AA100   A10    A2  B30A  B30B   B40 
    2     1     2     1     2     2 

$`Level 4`
AA100A   A10C    A2B  B30A1  B30B3  B30B1   B40A 
     2      1      2      1      1      1      2 

and respectively:

$`Level 1`
[1] 4

$`Level 2`
 AA   A B30   B 
  2   3   3   2 

$`Level 3`
AA100  AA10   A10    A2  B30A  B30B B30CA   B40 
    1     1     1     2     1     1     1     2 

Best

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions