How can I label a dataset

I am new to R. I am wondering how to label a dataset, like to label ADSL as " Subject Level Analysis Dataset"

Check here. Maybe you will find answer:

Thanks a lot. I checked the link and it is used for label variables or values. I have no problem to labeling variable or value. But I did not find a way to label data-frame or tibble or dataset.

what would it mean to 'label' a dataset, and in what context is that useful ?
do you perhaps just mean the name that its known by ?
you could indeed add arbitrary attributes, that you could access ... but is this worthwhile ?
attributes wont often come along for the ride when you use transformations, so they can be pretty fragile...
unless you want to get into making your own classes, but I think this would open up a big can of worms.
Something I do very occasionally is to keep related objects in a common list.

mydata <- head(iris)

     "mylabel") <- "This is to document that this data.frame was made by head(iris)"




mydata2 <- select(mydata,


mydata2 <- mydata
mydata2 <- select(mydata2,

mydata3 <- list(Note="The data.frame came from head(iris",
                df = head(iris))


Thanks you very much. I checked other SDTM dataset. Inside, they have $label attribute, and it should be similar to your example 'mylabel'.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.