knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

Homework 8: Building your own R package

Package Installation

We will use the devtools package to facilitate package development. Devtools and my package can be installed with the following commands, and both could be loaded with library command.

library(devtools)
library(gapminder)
#load_all()
devtools::install_github("zhengdong91/Test2")
library(Test2)

Function Testing

There are four functions in the package, we designed Quantiles and Top20GdpPercap functions to deal with the gapminder dataset, Quantiles return the difference of a numeric variable, and Top20GdpPercap return the top 20 GdpPercap countries in a particular year. I also inplemented two functions fbind and freq_out Jenny shared with us in the classes as a practice.

freq_out(iris$Species)
Top20GdpPercap(2002)
a <- factor(c("character", "hits", "your", "eyeballs"))
b <- factor(c("but", "integer", "where it", "counts"))
fbind(a, b)

Some useful links:



zhengdong91/Test2 documentation built on May 4, 2019, 10:17 p.m.