Learn R Programming

FinTS (version 0.3-9)

runscript: Run a package script

Description

Run a script associated with a particular chapter

Usage

runscript(x, method=c('run', 'copy', 'view', 'dir'),
          ask = TRUE, fmt="ch%02d.R", package="FinTS", 
          subdir="scripts", lib.loc=NULL)

Arguments

x
an object to identify a file in package/subdir via sprintf(fmt, x). For example, the default 'fmt' translates x = 2 into 'ch02.R'. If no 'x' is specified, a directory of options is provided. CAUTION: Under some systems like ESS (Emacs
method
One of the following:
  • run
{ run the desired script file, similar to demo or example. } copy{ make a copy if the desired script fi

Value

  • the full full path and filename, invisibly unless method == 'dir'

item

  • ask
  • fmt
  • subdir
  • package
  • lib.loc

Details

similar to demo or example

See Also

demo sprintf system.file package.dir Stangle vignette example

Examples

Run this code
# provide a menu
runscript()

# run ~R\library\FinTS\scripts\ch01.R 
runscript(1)

# same as:
runscript(1, "run")

# make a copy as 'ch01.R' in the working directory
runscript(1, 'copy')

# display only
runscript(1, 'view')

# where is it?
runscript(1, 'dir') 

# run ~R\library\nlme\scripts\afda-ch01.R
if(require(fda)) 
     runscript(1, fmt="afda-ch

Run the code above in your browser using DataLab