Type: Package
Title: Format Strings with Perl6::Form
Version: 0.1-1
Date: 2016-06-09
Maintainer: Enrico Schumann <es@enricoschumann.net>
Depends: R (≥ 3.2)
Description: A wrapper for Perl6::Form.
License: GPL-3
URL: http://enricoschumann.net/R/packages/Perl6.Form.html, http://search.cpan.org/dist/Perl6-Form/lib/Perl6/Form.pm
NeedsCompilation: no
Packaged: 2024-04-07 16:38:37 UTC; es19
Author: Enrico Schumann [aut, cre]
Built: R 4.5.0; ; 2024-04-07 16:38:37 UTC; unix

Format a String with Perl6::Form

Description

A wrapper around the Perl function form provided by Damian Conway's Perl6::Form module.

Usage

form(..., cat = TRUE, perl = "perl", form.options)

Arguments

...

character and numeric vectors. See Examples.

cat

logical: should result be printed?

perl

name and path of the perl programme

form.options

optional: a list of named options; see Examples.

Details

A simple wrapper, implemented via a call to system2.

Value

character

Author(s)

Enrico Schumann

References

See the extensive help of the Perl function: http://search.cpan.org/~dconway/Perl6-Form/lib/Perl6/Form.pm

See Also

system2

Examples


nums <- c(2.1711119999, 1000.1, 0.999)
form("* {]]]]]].[} *", nums)

##  ... results in
##  *       2.17 *
##  *    1000.1  *
##  *       1.00 * 


## use decimal separator as specified by locale
form("{]]]]]],[}", nums,
     form.options = list(locale = 1))



Names <- c("Al", "Bob", "Carl")
Values <- c(0.257, 100.1, 98)

form("+--------+--------+",
     "|     Id |  Value |",
     "+========+========+",
     "| {]][[} | {]].[} |",
          Names,    Values,
     "+--------+--------+")

##  ... results in
##  +--------+--------+
##  |     Id |  Value |
##  +========+========+
##  |   Al   |   0.26 |
##  |  Bob   | 100.1  |
##  |  Carl  |  98.0  |
##  +--------+--------+