Get help file description in R as an object

Clash Royale CLAN TAG#URR8PPPGet 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

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
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.
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