Package 'greekLetters'

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: 2024-10-17 05:26:15 UTC
Source: CRAN

Help Index


Function that returns strings with Greek letters

Description

Function to obtain strings with Greek letters and mathematical symbols with or without subscripts and superscripts.

Usage

greeks(greekletter)

Arguments

greekletter

is a string that contains the Greek letter name.

Details

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.

Value

Returns the desired Greek letter or mathematical symbol in string format.

Author(s)

Kévin Allan Sales Rodrigues.

Examples

# 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=", ")

Print Summary for Linear Model Fits With Greek Letters

Description

print summary method with Greek letters for class "lm".

Usage

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

Arguments

x

an object used to select a method.

digits

minimal number of significant digits, see print.default.

symbolic.cor

logical. If TRUE, print the correlations in a symbolic form (see symnum) rather than as numbers.

signif.stars

logical. If TRUE, ‘significance stars’ are printed for each coefficient.

concise

logical.

...

Arguments passed on to base::print, stats::summary.lm

object

an object of class "lm", usually, a result of a call to lm.

correlation

logical; if TRUE, the correlation matrix of the estimated parameters is returned and printed.

Details

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.

Value

The function is like print.summary.lm but with Greek letters in output.

Author(s)

Kévin Allan Sales Rodrigues.

See Also

See summary.lm for more details.

Examples

#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

Summarizing Linear Model Fits With Greek Letters

Description

summary method with Greek letters for class "lm".

Usage

summary_greek(object, correlation = FALSE, symbolic.cor = FALSE, ...)

Arguments

object

an object of class "lm", usually, a result of a call to lm.

correlation

logical; if TRUE, the correlation matrix of the estimated parameters is returned and printed.

symbolic.cor

logical. If TRUE, print the correlations in a symbolic form (see symnum) rather than as numbers.

...

further arguments passed to or from other methods.

Details

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.

Value

The function is like summary.lm but with Greek letters in output.

Author(s)

Kévin Allan Sales Rodrigues.

See Also

See summary.lm for more details.

Examples

# 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