readScript

0th

Percentile

Read the code blocks/chunks from a document

This is a general function that determines the type of the document and then extracts the code from it.

This is an S4 generic and so can be extended by other packages for document types that have a class, e.g. Word or OpenOffice documents.

readAnnotatedScript is for reading scripts that use a vocabulary to label code blocks with high-level task identifiers to indicate what the code does in descriptive terms.

Keywords
programming, IO
Usage
readScript(doc, type = NA, txt = readLines(doc), ...)
readAnnotatedScript(doc, txt = readLines(doc))
Arguments
doc

the document, typically a string giving the file name. This can also be a connection, e.g. created via url.

type

a string indicating the type of the document. If this is missing, the function calls getDocType to attempt to determine this based on the "common" types of documents.

txt

the lines of text of the document.

...

Passed to low-level input functions used by various methods.

Value

A list of the R expressions that constitute the code blocks.

See Also

parse

Aliases
  • readScript
  • readScript,character-method
  • readScript,connection-method
  • readScript,XMLInternalDocument-method
  • readScript,missing-method
  • readAnnotatedScript
Examples
# NOT RUN {
  e = readScript( system.file ("samples", "dual.R", package = "CodeDepends") )
  
# }
# NOT RUN {
  readScript(url("http://www.omegahat.net/CodeDepends/formula.R"))
# }
Documentation reproduced from package CodeDepends, version 0.6.5, License: GPL

Community examples

Looks like there are no examples yet.