PBSmodelling (version 2.68.8)

talk-class: S4: Present Talk Classes

Description

The function presentTalk is a tool that facilitates lectures and workshops in R. It allows the presenter to show code snippets alongside their execution, making use of R's graphical capabilities.

For presentTalk to work, six S4 class objects are created:

talk......root element that constitutes a talk;
section...branch element that defines a section within a talk;
text......leaf element that specifies text to be printed on the R console;
file......leaf element that specifies files to be opened by the OS;
code......leaf element that specifies R code to be executed;
break.....leaf element that specifies where to allow a break in the talk.

The leaf elements, also termed primitive elements, occur in isolation and cannot contain other elements. Therefore, only two levels of nesting are supported: sections within a talk and primitives within a section.
See Appendix B in the PBSmodelling User's Guide for more information.

Arguments

Slots Available

talk
namecharacterstring giving the name of the talk (required)
sectionslistlist of sections within the talk
fileslistlist of files within the talk
section
namecharacterstring giving the name of the section (required)
itemslistlist of the four primitive (leaf-element) S4 classes
buttonlogicalshould GUI have a button that selects section?
colintegercolumn in lower section of GUI to place button
section_idintegerspecify if section does not immediately follow a talk
text
textcharactertext to display on the R console
"break"logicalbreak the presentation after displaying the text specified?
file
namecharacterstring giving the name in the GUI for a group of files to open (required)
filenamecharacterindividual file names associated with the group name in the GUI
"break"logicalbreak the presentation after opening the group of files?
buttonlogicalshould GUI add a button that opens this group of files?
colintegercolumn in lower section of GUI to place button
code
showlogicalshow the code snippet in the R console?
printlogicalprint the results of running the R code?
codecharacterthe actual chunk of R code
"break"characterstring describing where to introduce breaks in the code segment
evallogicalevaluate the R code?
break
.xDataNULLallows a break in the talk for user interaction on the R console.

Creating S4 Objects

Objects can be created by calls of the form:


new("talk", name=name)
new("section",
  name     = node$attributes["name"],
  button   = as.logical(xmlGetAttr(node,"button",FALSE)),
  col      = as.integer(xmlGetAttr(node,"col",2)))
new("text", 
  text     = xmlValue(node),
  "break"  = as.logical(xmlGetAttr(node,"break",TRUE)))
new("file",
  name     = xmlGetAttr(node,"name",""), 
  "break"  = as.logical(xmlGetAttr(node,"break",TRUE)),
  filename = xmlValue(node),
  button   = as.logical(xmlGetAttr(node,"button",FALSE)),
  col      = as.integer(xmlGetAttr(node,"col",3)))
new("code",
  show     = as.logical(xmlGetAttr(node,"show",TRUE)), 
  print    = as.logical(xmlGetAttr(node,"print",TRUE)), 
  code     = xmlValue(node), 
  "break"  = tolower(xmlGetAttr(node,"break","print")))
new("break") 

Author

Alex Couture-Beil, Vancouver Island University, Nanaimo BC

Details

This function uses a convenience function called xmlGetAttr (from the package XML) that retrieves the value of a named attribute in an XML node.

The function presentTalk translates the XML code into a list structure called .presentTalk below the global object .PBSmod. The GUI is represented as a list structure called presentwin under .PBSmod, as for all GUI objects in PBSmodelling.

See Also

presentTalk for presenting a talk in R.

xmlGetAttr for retrieving the value of a named attribute in an XML node.

setClass for creating a class definition.

PBSoptions-class for a complicated S4 class implementation.