Learn R Programming

miceadds (version 2.10-14)

Rfunction_include_argument_values: Utility Functions for Writing R Functions

Description

Utility functions for writing R functions.

Usage

## include argument values in a function input
Rfunction_include_argument_values(string, maxlen = 70)

## assign objects to entries in a list Rfunction_output_list_result_function(string, mid = " <- res$")

Arguments

string

String

maxlen

Maximal string length for output

mid

Middle term in the output

Value

String

Examples

Run this code
# NOT RUN {
#############################################################################
# EXAMPLE 1: Toy examples
#############################################################################

##**** extend missing arguments

string <- "
          mice.impute.2l.pls2(y, ry, x , type , pls.facs = pls.facs  ))
          "
cat( Rfunction_include_argument_values(string) )
  ##    mice.impute.2l.pls2( y=y, ry=ry, x=x, type=type, pls.facs=pls.facs ) 

##**** assignment to objects as entries in a list

string <- "
          list( vname=vname, p, type=type, data=data, levels_id )
          "
cat( Rfunction_output_list_result_function( string ) )
  ##  
  ##  vname <- res$vname
  ##  p <- res$p
  ##  type <- res$type
  ##  data <- res$data
  ##  levels_id <- res$levels_id
# }

Run the code above in your browser using DataLab