knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>")

This foo package is built based on the method used in Jenny's foofactor. The goal of this package is to practice how to develop an R package based on lecture notes Write your own R package. I wrote two function in the package:

Installation

devtools::install_github("AriaGuo/r-package-practise")
library(foo)

First function

The first function string_bindis to bind two string characters into one string with unique values(default) or duplicated value. For the "duplicated" method, this function returns duplicated letters and the length of the returned value depends on how many times the letters are duplicated.Based on the unit test result, this function works on any characters but with some exceptions. See notation in testthat.R for detail.

>string_bind("abc","bcde",method = "UNIQUE")
[1] "abcde"
>string_bind("abc","bcde",method = "DUPLICATED")
[1] "bbb"
## letter b duplicated three times

Second function

The second function letter_order is to reorder input letter in a alphabetical order (default) or counter alphabetical order.Based on the unit test resutls, the function cannot handle white space, and letters with mixed capitalization very well. See examples in testthat.R

>letter_order("A,Z,U,O",normal.sort=TRUE)
[1] "A,O,U,Z"


AriaGuo/r-package-practise documentation built on May 5, 2019, 7:06 a.m.