Potential of The R Packages in Engineering
Potential of The R Packages in Engineering
in Engineering
__________________________________________________________________________________
Abstract
R could be a programing language and free software package setting for applied
mathematics computing and graphics supported by the R Foundation for statistical
Computing. The R language is widely used among statisticians and information miners for
developing statistical software system and information analysis. RStudio is an integrated
development setting for R, a programing language for statistical computing and graphics.
It is offered in 2 formats:
In recent times R has gained tons of recognition and lots of helpful R perform are available
in packages, free libraries of code written by R's active user community. to put in an R
package, open an R session and type at the program line
In this analysis article we are attending to choose six of the most recent packages in R and
elaborate on their application. These packages are namely:
✔ randomForest(2018-03-25)
✔ xtable(2019-04-21)
✔ httr(2019-08-05)
✔ devtools (2019-09-24)
✔ data.table (2019-12-09)
Introduction
In R, the fundamental unit of shareable code is the package. A package bundles together
code, data, documentation, and tests, and is easy to share with others. As of January 2015,
there were over 6,000 packages available on the Comprehensive R Archive Network, or
CRAN (https://cran.r-project.org/web/views/), the public clearing house for R packages.
R packages are a collection of R functions, complied code and sample data. They are stored
under a directory called "library" in the R environment. By default, R installs a set of
packages during installation. More packages are added later, when required. When we start
the R console, only the default packages are available by default. Other packages which are
already installed have to be loaded explicitly to be used by the R program that is going to use
them.
All the packages available in R language are listed as R Packages.
Literature Review
“R is really important to the point that it’s hard to overvalue it,” said Daryl Pregibon, a
research scientist at Google, which uses the software widely. “It allows statisticians to do
very intricate and complicated analyses without knowing the blood and guts of computing
systems.” - The New York Times, Article By Ashlee Vance, Jan. 6, 2009.
“R is excellent software that happens to be free. The wide array of statistical methods
available in R makes it an attractive platform for teaching a variety of courses.” - “USING
THE R STATISTICAL COMPUTING ENVIRONMENT TO TEACH SOCIAL STATISTICS
COURSES”, John Fox and Robert Andersen Department of Sociology McMaster University
January 2005
“R has now outgrown its origins and its development is now a collaborative effort undertaken
using the Internet to exchange ideas and distribute the results. The focus is now on how the
initial experiment can be turned into a viable piece of free software.”- “R : Past and Future
History A Draft of a Paper for Interface ’98”, Ross Ihaka Statistics Department The
University of Auckland Auckland, New Zealand, 1998
Description of Research
This package is an extension of the data.frame package. It enables fast aggregation of large
data (e.g. 100GB in RAM), fast ordered joins, fast add/modify/delete of columns by group
using no copies at all, list columns, friendly and fast character-separated-value read/write.
Offers a natural and flexible syntax, for faster development.
Below is a snippet implementing the use of setorder function of the data.table package along
with an output.
Description
In data.table parlance, all set* functions change their input by reference. That is, no copy is
made at all, other than temporary working memory, which is as large as one column. The
only other data.table operator that modifies input by reference is :=. data.table provides
setorder (and setorderv) reorders the rows of a data.table based on the columns (and column
order) provided. It reorders the table by reference and is therefore very memory efficient.
Note that queries like x[order(.)] are optimised internally to use data.table’s fast order. Also
note that data.table always reorders in "C-locale". To sort by session locale, use x
[base::order(.)]. bit64::integer64 type is also supported for reordering rows of a data.table.
Features
The aim of devtools is to make package development easier by providing R functions that
simplify and expedite common tasks. R Packages is a book based around this workflow.
Frequent development tasks:
▪ install() reinstalls the package, detaches the currently loaded version then reloads the
new version with library(). Reloading a package is not guaranteed to work: see the
documentation for unload() for caveats.
▪ build() builds a package file from package sources. You can use it to build a binary
version of your package.
▪ install_* functions install an R package:
✔ install_github() from GitHub
✔ install_gitlab() from GitLab
✔ install_bitbucket() from Bitbucket
✔ install_url() from an arbitrary url
✔ install_git() and install_svn() from an arbitrary git or SVN repository
✔ install_local() from a local file on disk
✔ install_version() from a specific version on CRAN
The aim of httr is to provide a wrapper for the curl package, customised to the demands of
modern web APIs.
Features
▪ Automatic connection sharing across requests to the same website (by default, curl
handles are managed automatically), cookies are maintained across requests, and a
up-to-date root-level SSL certificate store is used.
▪ Requests return a standard response object that captures the http status line, headers
and body, along with other useful information.
Simultaneous tests and confidence intervals for general linear hypotheses in parametric
models, including linear, generalized linear, linear mixed effects, and survival models. The
package includes demos reproducing analyzes presented in the book "Multiple Comparisons
Using R" (Bretz, Hothorn, Westfall, 2010, CRC Press).
Figure 1: cars data: Regression line with confidence bands (dashed) and intervals (dotted).
Asym xmid scal Asym 1.0000 0.9868 0.9008 xmid 0.9868 1.0000 0.9063 scal 0.9008 0.9063
1.0000
Example: Confidence Bands for Regression Line. Suppose we want to plot the linear model
fit to the cars data including an assessment of the variability of the model fit. This can be
based on simultaneous confidence intervals for the regression line
x ⊤ i βˆ: R> K <- model.matrix(lm.cars)[!duplicated(cars$speed),] R> ci.cars <-
confint(glht(lm.cars, linfct = K), abseps = 0.1)
Figure 1 depicts the regression fit together with the confidence band for the regression line
and the pointwise confidence intervals as computed by predict(lm.cars).
_____________________________________________________________________
Usage :
This function extracts tabular information from x and returns an object of class "xtable". The
nature of the table generated depends on the class of x. For example, aov objects produce
ANOVA tables while data.frame objects produce a table of the entire data frame. One can
optionally provide a caption or label (called an anchor in HTML), as well as formatting
specifications. Default values for align, digits, and display are class dependent.
The available method functions for xtable are given by methods(xtable). Users can extend the
list of available classes by writing methods for the generic function xtable. These methods
functions should have x as their first argument, with additional arguments to
specify caption, label, align, digits, and display. Optionally, other arguments may be passed
to specify how the object x should be manipulated. All method functions should return an
object whose class is c("xtable","data.frame"). The resulting object can have
attributes caption and label, but must have attributes align, digits, and display.
Conclusion
R is a proven programming language and free software environment for statistical
computing. With open source development of packages ever going on the R community will
definitely continue to provide packages to make ease for the programming and development
community by providing essential tools for them to work with. Each package comes with a
wide range of usability and provisions for the needs of the future.
References
https://cran.r-project.org/web/packages/available_packages_by_date.html
https://support.rstudio.com/hc/en-us/articles/201057987-Quick-list-of-useful-R-packages
https://en.wikipedia.org/wiki/RStudio
https://en.wikipedia.org/wiki/R_(programming_language)
https://www.tutorialspoint.com/r/r_packages.htm
https://github.com/Rdatatable/data.table
https://github.com/r-lib/devtools
https://github.com/r-lib/httr
http://multcomp.r-forge.r-project.org/
https://www.rdocumentation.org/packages/randomForest/versions/4.614/topics/randomForest
http://xtable.r-forge.r-project.org/