All Projects → pzhaonet → beginr

pzhaonet / beginr

Licence: other
an R package for beginners

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to beginr

javascript-sabuk-putih
Modal Awal Belajar Fundamental Javascript Untuk Mendalami React JS, Vue JS, Angular JS, ataupun Node JS
Stars: ✭ 47 (+213.33%)
Mutual labels:  beginner
Deep-Learning-With-TensorFlow
All the resources and hands-on exercises for you to get started with Deep Learning in TensorFlow
Stars: ✭ 38 (+153.33%)
Mutual labels:  beginner
CNN
A simple and extensible project based on TensorFlow-Slim image classification model library
Stars: ✭ 30 (+100%)
Mutual labels:  beginner
D3partitionR
R package to visualise interactively hierarchical data.
Stars: ✭ 36 (+140%)
Mutual labels:  cran
apsimx
R package for APSIM-X
Stars: ✭ 30 (+100%)
Mutual labels:  cran
PopED
Population Experimental Design (PopED) in R
Stars: ✭ 27 (+80%)
Mutual labels:  cran
globals
🌐 R package: Identify Global Objects in R Expressions
Stars: ✭ 27 (+80%)
Mutual labels:  cran
playing with vae
Comparing FC VAE / FCN VAE / PCA / UMAP on MNIST / FMNIST
Stars: ✭ 53 (+253.33%)
Mutual labels:  beginner
msgtools
Tools for Developing Diagnostic Messages
Stars: ✭ 18 (+20%)
Mutual labels:  cran
fullstackDevelopment
Material & Projects related to full stack development
Stars: ✭ 90 (+500%)
Mutual labels:  beginner
ctrdata
Aggregate and analyse information on clinical trials from public registers
Stars: ✭ 26 (+73.33%)
Mutual labels:  cran
open-source-DSA-code
open source contribution during hacktoberfest for beginners.
Stars: ✭ 31 (+106.67%)
Mutual labels:  beginner
fpp3package
All data sets required for the examples and exercises in the book "Forecasting: principles and practice" (3rd ed, 2020) by Rob J Hyndman and George Athanasopoulos <http://OTexts.org/fpp3/>. All packages required to run the examples are also loaded.
Stars: ✭ 93 (+520%)
Mutual labels:  cran
Ramble
A R parser based on combinatory parsers.
Stars: ✭ 19 (+26.67%)
Mutual labels:  cran
DGCA
Differential Gene Correlation Analysis
Stars: ✭ 32 (+113.33%)
Mutual labels:  cran
job-shop-scheduling
Determine a schedule for running a set of jobs.
Stars: ✭ 34 (+126.67%)
Mutual labels:  beginner
bruceR
📦 BRoadly Useful Convenient and Efficient R functions that BRing Users Concise and Elegant R data analyses.
Stars: ✭ 110 (+633.33%)
Mutual labels:  cran
RcppXPtrUtils
XPtr Add-Ons for 'Rcpp'
Stars: ✭ 17 (+13.33%)
Mutual labels:  cran
skill-sample-nodejs-hello-world
No description or website provided.
Stars: ✭ 196 (+1206.67%)
Mutual labels:  beginner
flutter-todo-list-tutorial
✅ A detailed example/tutorial building a cross-platform Todo List App using Flutter 🦋
Stars: ✭ 60 (+300%)
Mutual labels:  beginner

Introduction

‘beginr’ is a collection of useful functions for R beginners, including hints for the arguments of the ‘plot()’ function, self-defined functions for error bars, user-customized pair plots and hist plots, enhanced linear regression figures, etc.. This package could be helpful to R experts as well.

Installation

# stable version on CRAN
install.package("beginr")
# or development version on GitHub
devtools::install_github("pzhaonet/beginr")

Quick Start

Functions as Memos

If you often forget the options for pch, lty, type, and col when you plot(), you can run plotpch(), plotlty(), plottype(), plotcolors(), and plotcolorbar(). No need to search the internet any more.

beginr::plotpch()

beginr::plotlty()

beginr::plottype()

beginr::plotcolors()

beginr::plotcolorbar()

Functions for Easy Plotting

Linear regression is often used in scientific work, but it is annoying to display the results. In R you have to run lm(), plot(), abline(), text() and so on and so forth. Now with ‘beginr’ you only have to run plotlm().

x <- 1:10
y <- 1:10 + rnorm(10)
beginr::plotlm(x, y)

## [[1]]
##               Estimate Std. Error   t value     Pr(>|t|)
## (Intercept) -0.8826021 0.59514844 -1.482995 1.763634e-01
## x            1.1693736 0.09591686 12.191533 1.899987e-06
## 
## [[2]]
## [1] 0.9489254

If you want to display the distribution of a data-set, use plothist(), which gives you a histogram with markers of the median, mean, quantiles, standard deviation, sample number and the skewness.

x <- rnorm(10000)
beginr::plothist(x)

##     para         value
## 1    min -3.9594329262
## 2     1q -0.6743155802
## 3 median  0.0151220580
## 4     3q  0.6806285656
## 5    max  4.1576382225
## 6  lower -2.7065331755
## 7  upper  2.7128461609
## 8   mean -0.0005589431
## 9     sd  1.0064399683

I like pairs(), and ‘beginr’ gives more powerful features to plotpairs() and plotpairs2().

df <- data.frame(a = 1:10, b = 1:10 + rnorm(10), c = 1:10 + rnorm(10))
beginr::plotpairs(df)

beginr::plotpairs2(df)
## [1] "p<0.01"
## [1] "p<0.01"
## [1] "p<0.01"

I often have to plot one independent variable (x) and multiple dependent variables (y1, y2, …, yn) in one 2-D coordinate system, or one dependent variable (y) against multiple independent variables (x1, x2, …, xn) with their error bars. Use dfplot() or dfplot2() in ‘beginr’.

x <- seq(0, 2 * pi, length.out = 100)
y <- data.frame(sin(x), cos(x))
yerror <- data.frame(abs(rnorm(100, sd = 0.3)), abs(rnorm(100, sd = 0.1)))
beginr::dfplot(x, y, yerror = yerror)

beginr::dfplot2(y, x, xerror = yerror)

If you would like to add errorbars only, then use errorbar().

x <- seq(0, 2 * pi, length.out = 100)
y <- sin(x)
plot(x, y, type = "l")
beginr::errorbar(x, y, yupper = 0.1, ylower = 0.1)

Functions for Data Frames

lmdf() performs the linear regression between every two columns in a data frame.

df <- data.frame(a = 1:10, b = 1:10 + rnorm(10), c = 1:10 + rnorm(10))
beginr::lmdf(df)
##   x y r.squared adj.r.squared  intercept     slope Std.Error.intercept
## 1 a b 0.9630442     0.9584247 -0.7901086 1.1271749           0.4843895
## 2 a c 0.8568806     0.8389907 -0.3427519 1.0425054           0.9346580
## 3 b a 0.9630442     0.9584247  0.8783157 0.8543876           0.3749251
## 4 b c 0.8157952     0.7927696  0.6004724 0.8856059           0.9426967
## 5 c a 0.8568806     0.8389907  1.0688792 0.8219436           0.7466774
## 6 c b 0.8157952     0.7927696  0.4432909 0.9211717           0.9729768
##   Std.Error.slope t.intercept   t.slope Pr.intercept     Pr.slope
## 1      0.07806644  -1.6311430 14.438661   0.14150586 5.177385e-07
## 2      0.15063377  -0.3667137  6.920795   0.72334232 1.219459e-04
## 3      0.05917360   2.3426432 14.438661   0.04722045 5.177385e-07
## 4      0.14878374   0.6369730  5.952303   0.54193651 3.410966e-04
## 5      0.11876434   1.4315142  6.920795   0.19016727 1.219459e-04
## 6      0.15475888   0.4556027  5.952303   0.66078732 3.410966e-04

There are two functions as improvements of tapply() for factor calculation.

beginr::tapplydf()
beginr::tapplydfv()

Functions for Reading and Writing files

readdir() reads multiple files into a list.

beginr::readdir()

writefile() avoids overwriting the files which already exist.

beginr::writefile()

list2ascii() saves a list as a text file.

alist <- list(a = 1:10, b = letters)
beginr::list2ascii(alist)

Functions for Packages

bib() creates bibliographic entries as texts or a file (‘.bib’).

beginr::bib(pkg = c("mindr", "bookdownplus", "pinyin", "beginr"))
## @Manual{R-beginr,
##   title = {beginr: Functions for R Beginners},
##   author = {Peng Zhao},
##   year = {2017},
##   note = {R package version 0.1.0},
##   url = {https://github.com/pzhaonet/beginr},
## }
## @Manual{R-bookdownplus,
##   title = {bookdownplus: Generate Varied Books and Documents with R 'bookdown' Package},
##   author = {Peng Zhao},
##   year = {2017},
##   note = {R package version 1.2.2},
##   url = {https://github.com/pzhaonet/bookdownplus},
## }
## @Manual{R-mindr,
##   title = {mindr: Convert Files Between Markdown or Rmarkdown Files and Mindmaps},
##   author = {Peng Zhao},
##   year = {2017},
##   note = {R package version 1.1.0},
##   url = {https://github.com/pzhaonet/mindr},
## }
## @Manual{R-pinyin,
##   title = {pinyin: Convert Chinese Characters into Pinyin},
##   author = {Peng Zhao},
##   year = {2017},
##   note = {R package version 1.1.0},
##   url = {https://github.com/pzhaonet/pinyin},
## }

plotpkg() displays a figure showing the downloads of packages.

beginr::plotpkg("beginr", from = "2017-06-23")

rpkg() creates a new R package in an easy way.

beginr::rpkg()

Updates

  • 2019-01-25. v0.1.5. New function packr().
  • 2019-01-05. v0.1.4. Enhanced readdir().
  • 2018-06-12. v0.1.3. the condition length in 'if()' was checked.
  • 2017-11-22. v0.1.2. Bugs fixed.
  • 2017-08-16. v0.1.1. Bugs fixed. plothist() improved.
  • 2017-07-19. v0.1.0. Updated on CRAN. See the release note.
  • 2017-07-04. v0.0.3. Two more functions: plotcolorbar() and plotpkg().
  • 2017-06-30. v0.0.2. One more function: rpkg() to create a skeleton for creating a new R package.
  • 2017-06-23. v0.0.1. Released on CRAN.
  • 2017-06-22. v0.0.0. Preliminary.

To do

  • created a universal RStudio addin like rmd::rmdAddin() for agroup of packages.

References

Zhao, Peng. 2017. Beginr: Functions for R Beginners. https://github.com/pzhaonet/beginr.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].