시작하기무료로 시작하기

Design an R package vignette

This document is the vignette skeleton dist_conversion.Rmd created in the last exercise. It includes the most familiar parts of an R Markdown document:

  • A YAML header that contains some metadata
  • Narrative text written in Markdown
  • R code chunks surrounded by ```{r} and ```; a syntax that comes from the knitr package

To develop package documentation for the unitConverter package, it is vital to show users many different ways to work with the functionality of the package. Vignettes serve that purpose in both showing examples and also adding explanatory text and clarifications in an easy-to-read format.

이 연습은 강의의 일부입니다

Developing R Packages

강의 보기

연습 안내

  • Create a heading on line 22 of "Convert feet to meters" with no subheadings.
  • Add "We can use the package to convert 5 feet into meters as follows." after the the heading, leading one line of space.
  • In the dist-example chunk, make the appropriate call to the dist_converter() function to achieve the task you have described.
  • At the end, output the result inline with "Five feet is r dist_result meters."

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

{"dist_conversion.Rmd":"___\ntitle: \"Distance Conversion Examples\"\noutput: rmarkdown::html_vignette\nvignette: >\n  %\\VignetteIndexEntry{Distance Conversion Examples}\n  %\\VignetteEngine{knitr::rmarkdown}\n  %\\VignetteEncoding{UTF-8}\n___\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#>\"\n)\n```\n\n```{r setup}\nlibrary(unitConverter)\n```\n\n\n\n\n\n```{r dist-example}\ndist_result <- \n```\n\n\n"}
코드 편집 및 실행