Skip to content

hsherrod2019/Week4RepoReal

Repository files navigation

Week 4 R Package: Making an R Package

Twitter Follow

Week 4: Making an R Package Using Week 2 Functions

  1. Installation
  2. Contact
  3. Contributing
  4. What is an R package
  5. Key points of an R package
  6. My R Package
  7. Roadmap
  8. Helpful Resources

Installation

Week4RepoReal is available from GitHub

Install from GitHub

To install the development version of the package, load the following code into R studio:

if(!require(devtools))
install.packages("devtools")

if(!require(OpenSpecy))
install.packages("OpenSpecy")

devtools::install_github("hsherrod2019/Week4RepoReal")

Getting Started

Make sure to load the OpenSpecy package which contains the raman_hdpe.csv; the csv can also be found under the 'Data' tab on the repository

library(devtools)
library(Week4RepoReal)
library(OpenSpecy)

Workflow

This package looks at the average wavenumber, average intensity, and intensity ratio of two peaks

# Calculate the average wavenumber of the raman_hdpe data set
calculate_average_wavenumber(raman_hdpe)

# Calculate the average intensity of the raman_hdpe data set
calculate_average_intensity(raman_hdpe)

# Calculate the ratio of two intensity peaks; make sure to input two values for x and y
calculate_intensity_ratio(x, y)

Reference

Here is the Open Specy webpage as a reference to how the functions for these R packages were created.

Contact

If you want to connect with me, email here

Contributing

Contributions of all kinds are greatly appreciated! Contact here on how to get started

Remember to adhere to this project's Code of Conduct

What is an R Package?

An R package is a collection of functions, data, and documentation that acts like a toolkit for users to perform tasks in R studio. They are created by developers and shared with the R community.

Key points of an R Package

  1. Functionality: Each package typically focuses on a specific area of analysis
  2. Installation: Need to install an R package to use it
  3. Loading a package: Need to load an R package once it is installed
  4. Function usage: After loading a package, you can use its functions to perform specific tasks
  5. Documentation: R packages come with documentation that explains how to use their functions and provide examples
  6. Community and updates: R packages are created and maintained by a community of developers and are often updated to fix bugs, add new features, etc.

My R Package

Created an R package incorporating three functions that I created during the Week 2 training.

#1 Calculate Average Wavenumber

#2 Calculate Average Intensity

#3 Calculate Intensity Ratio

Roadmap

gantt
    title Roadmap Practice Timeline for Week 4
    dateFormat  YYYY-MM-DD
    section creating the R Package
    Examples of other R Packages                :2023-06-26,                             2023-06-30
    How to incorporate functions                :2023-06-26,                             2023-06-30
    Putting R packages together                               :2023-06-28,               2023-07-03
    section making week 4 repo
    Outline of repo                                                         :2023-06-29, 2023-07-03
    Including external links                                                            :2023-06-30,    2023-06-30
    Format and grammar corrections                                                      :2023-06-30,    2023-07-03
Loading

Helpful Resources

Examples of R Packages

Tutorial on how to build an R Package

About

Updated week 4 repository

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages