Set2expr: Conversion of a vector into a string

View source: R/Set2expr.R

Set2exprR Documentation

Conversion of a vector into a string

Description

The function converts a set into a string.

Usage

Set2expr(v = NULL )

Arguments

v

Set

Value

string

the string

Note

Called by the MFB and MFB functions in the kStatistics package being useful for manipulating the result before its print.

Author(s)

Elvira Di Nardo elvira.dinardo@unito.it,
Giuseppe Guarino giuseppe.guarino@rete.basilicata.it

Examples

 
# To print 6f[3]^2g[2]^5 run 
Set2expr( list(c("1","2","f","3","2"),c("1","3","g","2","5"))) 

# Run MFB(c(3),1) to recover f[3]g[1]^3 + 3f[2]g[1]g[2] + f[1]g[3]
# Run S<-MFB2Set(MFB(c(3),1)) to convert the output of MFB(c(3),1) into a vector.  
# The result is
# "1" "1" "f" "3" "1"
# "1" "1" "g" "1" "3"
# "2" "3" "f" "2" "1"
# "2" "1" "g" "1" "1"
# "2" "1" "g" "2" "1"
# "3" "1" "f" "1" "1"
# "3" "1" "g" "3" "1"
# To set f[2]=1, run S[[3]][4]<-"" and S[[3]][3]<-"".
# Then run Set2expr(S) to recover  
# f[3]g[1]^3 + 3g[1]g[2] + f[1]g[3]
#
S<-MFB2Set(MFB(c(3),1))
S[[3]][4]<-""
S[[3]][3]<-""
Set2expr(S)

kStatistics documentation built on June 8, 2022, 5:05 p.m.