Returns attributes values of tracks.

emr_track.attr.export(track = NULL, attr = NULL, include_missing = FALSE)

Arguments

track

a vector of track names or 'NULL'

attr

a vector of attribute names or 'NULL'

include_missing

when TRUE - adds a row for tracks which do not have the 'attr' with NA, or tracks which do not exist. Otherwise tracks without an attribute would be omitted from the data frame, and an error would be thrown for tracks which do not exist.

Value

A data frame containing attributes values of tracks.

Details

This function returns a data frame that contains attributes values of one or more tracks. The data frame is constituted of 3 columns named 'track', 'attr' and 'value'.

'track' parameter is optionally used to retrieve only the attributes of the specific track(s). If 'NULL', attributes of all the tracks are returned.

Likewise 'attr' allows to retrieve only specifically named attributes.

If both 'track' and 'attr' are used, the attributes that fulfill both of the conditions are returned

Overriding a track also overrides it's track attributes, the attributes will persist when the track is no longer overridden.

Examples


emr_db.init_examples()
#> NULL
emr_track.attr.export()
#>          track      attr  value
#> 1  dense_track    gender   male
#> 2 sparse_track    gender female
#> 3 sparse_track test_attr  value
emr_track.attr.set("sparse_track", "gender", "female")
emr_track.attr.set("sparse_track", "tag", "")
emr_track.attr.set("dense_track", "gender", "male")
emr_track.attr.export()
#>          track   attr  value
#> 1  dense_track gender   male
#> 2 sparse_track gender female
#> 3 sparse_track    tag       
emr_track.attr.export(track = "sparse_track")
#>          track   attr  value
#> 1 sparse_track gender female
#> 2 sparse_track    tag       
emr_track.attr.export(attr = "gender")
#>          track   attr  value
#> 1  dense_track gender   male
#> 2 sparse_track gender female
emr_track.attr.export(track = "sparse_track", attr = "gender")
#>          track   attr  value
#> 1 sparse_track gender female