Get help file description in R as an object

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Get help file description in R as an object



I'm trying to build a shiny app that manipulates some base R datasets, like datasets::airmiles. I'd like to display somewhere within that app the description of this dataset. For instance, ?datasets::airmiles yields -


datasets::airmiles


?datasets::airmiles



enter image description here



Is there any way I can extract the description string? e.g. in this case, it would be the string 'The revenue passenger miles flown by commercial airlines in the United States for each year from 1937 to 1960.'



I have tried -


x <- help('airmiles')
str(x)
# 'help_files_with_topic' chr "C:/Program Files/R/R-3.5.1/library/datasets/help/airmiles"
# - attr(*, "call")= language help(topic = "airmiles")
# - attr(*, "topic")= chr "airmiles"
# - attr(*, "tried_all_packages")= logi FALSE
# - attr(*, "type")= chr "html"



But x does not contain the description of airmiles.


x


airmiles





Hi, That creates a trees.txt file. I want to use the description in shiny, and would like to store it in an object. For instance, in the above example x <- 'The revenue passenger miles flown by commercial airlines in the United States for each year from 1937 to 1960.' would have been the desired object.
– Ameya
38 mins ago


x <- 'The revenue passenger miles flown by commercial airlines in the United States for each year from 1937 to 1960.'




1 Answer
1



Seems to work for what you want but I'd take out the semi-colons:



R help page as object



Can be accessed by var$description.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

Future solutions