Title: | Routines for Writing Greek Letters and Mathematical Symbols on the 'RStudio' and 'RGui' |
---|---|
Description: | An implementation of functions to display Greek letters on the 'RStudio' (include subscript and superscript indexes) and 'RGui' (without subscripts and only with superscript 1, 2 or 3; because 'RGui' doesn't support printing the corresponding Unicode characters as a string: all subscripts ranging from 0 to 9 and superscripts equal to 0, 4, 5, 6, 7, 8 or 9). The functions in this package do not work properly on the R console. Characters are used via Unicode and encoded as UTF-8 to ensure that they can be viewed on all operating systems. Other characters related to mathematics are included, such as the infinity symbol. All this accessible from very simple commands. This is a package that can be used for teaching purposes, the statistical notation for hypothesis testing can be written from this package and so it is possible to build a course from the 'swirlify' package. Another utility of this package is to create new summary functions that contain the functional form of the model adjusted with the Greek letters, thus making the transition from statistical theory to practice easier. In addition, it is a natural extension of the 'clisymbols' package. |
Authors: | Kevin Allan Sales Rodrigues [aut, cre]
|
Maintainer: | Kevin Allan Sales Rodrigues <[email protected]> |
License: | GPL (>= 2.0) |
Version: | 1.0.4 |
Built: | 2025-02-14 05:42:50 UTC |
Source: | https://github.com/cran/greekLetters |
Function to obtain strings with Greek letters and mathematical symbols with or without subscripts and superscripts.
greeks(greekletter)
greeks(greekletter)
greekletter |
is a string that contains the Greek letter name. |
It is recommended that the font size of the R console be increased for better visualization of the symbols, as some of the symbols are quite small.
The subscripts and supersripts are restricted to numbers 0 to 9.
For users working with Rgui this function don't accept subscripts and just accept superscripts 1, 2 and 3. For more details run the commands:
symbols printed as a "rectangle" don't work in RGui, but these symbols work normally in RStudio.
To see names of symbols use print_greeks
.
Returns the desired Greek letter or mathematical symbol in string format.
Kévin Allan Sales Rodrigues.
# Linear regression paste("y", " = X", greeks("beta"), " + ", greeks("epsilon"), sep ="") # pi constant paste(greeks("pi"), greeks("almostEqual"), "3.14") # Expected value paste("E[X] = ", greeks("integral"), "xf(x)dx", sep = "") greeks("sigma^2") greeks("Delta^5") greeks("yourname^9") # testing statistical hypothesis paste(greeks("H_0"),":", greeks("mu"), " = 0") paste("versus", greeks("H_1"), ":", greeks("notEqual"), " 0" ) # returns the Greek letters paste("The Greek letters", greeks("alpha"), greeks("beta"), "...", greeks("omega"), ".", sep=", ")
# Linear regression paste("y", " = X", greeks("beta"), " + ", greeks("epsilon"), sep ="") # pi constant paste(greeks("pi"), greeks("almostEqual"), "3.14") # Expected value paste("E[X] = ", greeks("integral"), "xf(x)dx", sep = "") greeks("sigma^2") greeks("Delta^5") greeks("yourname^9") # testing statistical hypothesis paste(greeks("H_0"),":", greeks("mu"), " = 0") paste("versus", greeks("H_1"), ":", greeks("notEqual"), " 0" ) # returns the Greek letters paste("The Greek letters", greeks("alpha"), greeks("beta"), "...", greeks("omega"), ".", sep=", ")
Function to Print all Greek letters and mathematical symbols names.
print_greeks()
print_greeks()
It is recommended that the font size of the R console be increased for better visualization of the symbols, as some of the symbols are quite small.
The subscripts and supersripts are restricted to numbers 0 to 9.
Symbols printed as a "rectangle" don't work in RGui, but these symbols work normally in RStudio.
Print all Greek letters and mathematical symbols names.
Kévin Allan Sales Rodrigues.
#all Greek letters and mathematical symbols names print_greeks()
#all Greek letters and mathematical symbols names print_greeks()
print summary method with Greek letters for class "lm".
## S3 method for class 'summary_greek' print( x, digits = max(3L, getOption("digits") - 3L), symbolic.cor = x$symbolic.cor, signif.stars = getOption("show.signif.stars"), concise = FALSE, ... )
## S3 method for class 'summary_greek' print( x, digits = max(3L, getOption("digits") - 3L), symbolic.cor = x$symbolic.cor, signif.stars = getOption("show.signif.stars"), concise = FALSE, ... )
x |
an object used to select a method. |
digits |
minimal number of significant digits, see
|
symbolic.cor |
logical. If |
signif.stars |
logical. If |
concise |
logical. |
... |
Arguments passed on to
|
It is recommended that the font size of the R console be increased for better visualization of the symbols, as some of the symbols are quite small.
The function is like print.summary.lm but with Greek letters in output.
Kévin Allan Sales Rodrigues.
See summary.lm
for more details.
#Same example as summary.lm and print.summary.lm from stat packages but with Greek letters. ## Annette Dobson (1990) "An Introduction to Generalized Linear Models". ## Page 9: Plant Weight Data. ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2, 10, 20, labels = c("Ctl","Trt")) weight <- c(ctl, trt) lm.D9 <- lm(weight ~ group) lm.D90 <- lm(weight ~ group - 1) # omitting intercept coef(lm.D90) # the bare coefficients summary_greek(lm.D90 <- lm(weight ~ group -1)) # omitting intercept
#Same example as summary.lm and print.summary.lm from stat packages but with Greek letters. ## Annette Dobson (1990) "An Introduction to Generalized Linear Models". ## Page 9: Plant Weight Data. ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2, 10, 20, labels = c("Ctl","Trt")) weight <- c(ctl, trt) lm.D9 <- lm(weight ~ group) lm.D90 <- lm(weight ~ group - 1) # omitting intercept coef(lm.D90) # the bare coefficients summary_greek(lm.D90 <- lm(weight ~ group -1)) # omitting intercept
summary method with Greek letters for class "lm".
summary_greek(object, correlation = FALSE, symbolic.cor = FALSE, ...)
summary_greek(object, correlation = FALSE, symbolic.cor = FALSE, ...)
object |
an object of class |
correlation |
logical; if |
symbolic.cor |
logical. If |
... |
further arguments passed to or from other methods. |
It is recommended that the font size of the R console be increased for better visualization of the symbols, as some of the symbols are quite small.
The function is like summary.lm but with Greek letters in output.
Kévin Allan Sales Rodrigues.
See summary.lm
for more details.
# Same example as summary.lm but with Greek letters ## Annette Dobson (1990) "An Introduction to Generalized Linear Models". ## Page 9: Plant Weight Data. ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2, 10, 20, labels = c("Ctl","Trt")) weight <- c(ctl, trt) lm.D9 <- lm(weight ~ group) lm.D90 <- lm(weight ~ group - 1) # omitting intercept coef(lm.D90) # the bare coefficients summary_greek(lm.D90 <- lm(weight ~ group -1)) # omitting intercept
# Same example as summary.lm but with Greek letters ## Annette Dobson (1990) "An Introduction to Generalized Linear Models". ## Page 9: Plant Weight Data. ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2, 10, 20, labels = c("Ctl","Trt")) weight <- c(ctl, trt) lm.D9 <- lm(weight ~ group) lm.D90 <- lm(weight ~ group - 1) # omitting intercept coef(lm.D90) # the bare coefficients summary_greek(lm.D90 <- lm(weight ~ group -1)) # omitting intercept