Function to extract the comments of a workspace

get_comment(x)

Arguments

x

the object from which the comments are retrieved.

Value

A string or list of string with all the comment contained in a SA-Item, a SA-Processing or a workspace (depending on the argument x).

Examples


library("RJDemetra")
ws_dir <- file.path(system.file("extdata", package = "rjdworkspace"), "WS")

path_ws_to <- file.path(ws_dir, "ws_output.xml")

ws_output <- load_workspace(path_ws_to)
print(get_comment(ws_output))
#> $`SAProcessing-1`
#> $`SAProcessing-1`$RF1011
#> [1] ""
#> 
#> $`SAProcessing-1`$RF1012
#> [1] ""
#> 
#> $`SAProcessing-1`$RF1013
#> [1] ""
#> 
#> $`SAProcessing-1`$RF1020
#> [1] ""
#> 
#> $`SAProcessing-1`$RF1031
#> [1] ""
#> 
#> $`SAProcessing-1`$RF1032
#> [1] ""
#> 
#> 
#> $`SAProcessing-2`
#> $`SAProcessing-2`$RF1020
#> [1] ""
#> 
#> $`SAProcessing-2`$RF1031
#> [1] ""
#> 
#> $`SAProcessing-2`$RF1032
#> [1] ""
#> 
#> $`SAProcessing-2`$RF1039
#> [1] ""
#> 
#> $`SAProcessing-2`$RF1041
#> [1] ""
#> 
#> $`SAProcessing-2`$RF1042
#> [1] ""
#> 
#> 
#> $`SAProcessing-3`
#> $`SAProcessing-3`$RF1039
#> [1] ""
#> 
#> $`SAProcessing-3`$RF1041
#> [1] ""
#> 
#> $`SAProcessing-3`$RF1042
#> [1] "Nouveau commentaire depuis la GUI"
#> 
#> $`SAProcessing-3`$RF1051
#> [1] "Second commentaire depuis la GUI"
#> 
#> $`SAProcessing-3`$RF1052
#> [1] ""
#> 
#> $`SAProcessing-3`$RF1061
#> [1] ""
#> 
#> 

sap_output <- get_object(ws_output, pos = 3)
print(get_comment(sap_output))
#> $RF1039
#> [1] ""
#> 
#> $RF1041
#> [1] ""
#> 
#> $RF1042
#> [1] "Nouveau commentaire depuis la GUI"
#> 
#> $RF1051
#> [1] "Second commentaire depuis la GUI"
#> 
#> $RF1052
#> [1] ""
#> 
#> $RF1061
#> [1] ""
#> 

sa_item <- get_object(sap_output, pos = 3)
print(get_comment(sa_item))
#> [1] "Nouveau commentaire depuis la GUI"