0% found this document useful (0 votes)
71 views14 pages

Potential of The R Packages in Engineering

The httr package provides tools for working with HTTP and REST APIs in R. It allows users to build and handle HTTP requests, making it easy to interact with APIs from R. Some key features include functions for generating GET, POST, PUT, DELETE and other types of HTTP requests, handling responses, authentication, and more. The package has no dependencies other than the base R installation, making it lightweight and portable. Httr sees widespread use for accessing APIs and web services directly from R code.

Uploaded by

Jack Lawes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views14 pages

Potential of The R Packages in Engineering

The httr package provides tools for working with HTTP and REST APIs in R. It allows users to build and handle HTTP requests, making it easy to interact with APIs from R. Some key features include functions for generating GET, POST, PUT, DELETE and other types of HTTP requests, handling responses, authentication, and more. The package has no dependencies other than the base R installation, making it lightweight and portable. Httr sees widespread use for accessing APIs and web services directly from R code.

Uploaded by

Jack Lawes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Potential of the R packages

in Engineering

Name: Anish Sarkar


Registration No: 19BCE1278
Name: Debarshi Das
Registration No: 19BCE1608
Slot: L21 – L22

__________________________________________________________________________________
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:

 RStudio Desktop could be a regular desktop application


 RStudio Server runs on a far off server and permits accessing RStudio employing a
applications programme.

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

install.packages("<the package's name>")

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)

The methodology that will be followed is:

1. Understanding the field of application of the R package.


2. Using a suitable dataset OR generating the required dataset for testing the packages.

3. Examining the output against the desired output.

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.

A GNU package source code for the R software environment is written primarily


in C, Fortran, and R itself and is freely available under the GNU General Public License. Pre-
compiled binary versions are provided for various operating systems. Although R has
a command line interface, there are several graphical user interfaces, such as RStudio,
an integrated development environment. Due to the popularity of R, RStudio is growing as
the preferred IDE to work with R by many software developers and analysts.

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

data.table Release Date: 2019-12-09


_____________________________________________________________________

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

▪ fast and friendly delimited file reader: ?fread, see also convenience features


for small data
▪ fast and feature rich delimited file writer: ?fwrite
▪ low-level parallelism: many common operations are internally parallelized to use
multiple CPU threads
▪ fast and scalable aggregations; e.g. 100GB in RAM (see benchmarks on up to two
billion rows)
▪ fast and feature rich joins: ordered joins (e.g. rolling forwards, backwards, nearest and
limited staleness), overlapping range joins (similar to IRanges::findOverlaps), non-
equi joins (i.e. joins using operators >, >=, <, <=), aggregate on
join (by=.EACHI), update on join
▪ fast add/update/delete columns by reference by group using no copies at all
▪ fast and feature rich reshaping data: ?dcast (pivot/wider/spread) and ?
melt (unpivot/longer/gather)
▪ any R function from any R package can be used in queries not just the subset of
functions made available by a database backend, also columns of type list are
supported
▪ has no dependencies at all other than base R itself, for simpler
production/maintenance
▪ the R dependency is as old as possible for as long as possible, dated April 2014, and
we continuously test against that version; e.g. v1.11.0 released on 5 May 2018
bumped the dependency up from 5 year old R 3.0.0 to 4 year old R 3.1.0

devtools Release Date: 2019-09-24


_____________________________________________________________________

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:

▪ load_all() simulates installing and reloading your package, loading R code in R/,


compiled shared objects in src/ and data files in data/. During development you
usually want to access all functions (even un-exported internal ones)
so load_all() works as if all functions were exported in the package NAMESPACE.

▪ document() updates generated documentation in man/, file collation


and NAMESPACE.

▪ test() reloads your code with load_all(), then runs all testthat tests.

▪ test_coverage() runs test coverage on your package with covr. This makes it easy to


see what parts of your package could use more tests.

Building and installing:

▪ 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

▪ update_packages() updates a package to the latest version. This works both on


packages installed from CRAN as well as those installed from any of
the install_* functions.
Check and release:

● check() updates the documentation, then builds and checks the package


locally. check_win() checks a package using win-builder, and check_rhub() checks a
package using r-hub. This allows you to easily check your package on all systems
CRAN uses before submission.
● release() makes sure everything is ok with your package (including asking you a
number of questions), then builds and uploads to CRAN.

httr Release date: 2019-08-05


_____________________________________________________________________

The aim of httr is to provide a wrapper for the curl package, customised to the demands of
modern web APIs.

Features

▪ Functions for the most important http


verbs: GET(), HEAD(), PATCH(), PUT(), DELETE() and POST().

▪ 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.

✔ Response content is available with content() as a raw vector (as = "raw"), a


character vector (as = "text"), or parsed into an R object (as = "parsed"),
currently for html, xml, json, png and jpeg.

✔ You can convert http errors into R errors with stop_for_status().

▪ Config functions make it easier to modify the request in common


ways: set_cookies(), add_headers(), authenticate(), use_proxy(), verbose(), timeout(), 
content_type(), accept(), progress().
▪ Support for OAuth 1.0 and 2.0 with oauth1.0_token() and oauth2.0_token(). The
demo directory has eight OAuth demos: four for 1.0 (twitter, vimeo) and four for 2.0
(facebook, github, google, linkedin). OAuth credentials are automatically cached
within a project.

httr wouldn’t be possible without the hard work of the authors of curl and libcurl.

httr is inspired by http libraries in other languages, such as Resty, Requests and httparty.

multcomp Release Date: 2020-01-10


_____________________________________________________________________

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).

randomForest Release Date: 2018-03-25


_____________________________________________________________________

randomForest implements Breiman's random forest algorithm (based on Breiman and Cutler's


original Fortran code) for classification and regression. It can also be used in unsupervised
mode for assessing proximities among data points.
The underlying code depicts the usage of the package.

xtable Release Date: 2019-04-21

_____________________________________________________________________

Convert an R object to an xtable object, which can then be printed as a LaTeX or HTML


table.

Usage :

xtable(x, caption = NULL, label = NULL, align = NULL, digits = NULL,


display = NULL, auto = FALSE, ...)
Details:

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/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy