Learn R Programming

treemisc (version 0.0.1)

guide_setup: Generate GUIDE input files

Description

Just a simple helper function I found useful while using the GUIDE terminal application (http://pages.stat.wisc.edu/~loh/guide.html). It creates two input text files required by GUIDE: a data file and description file.

Usage

guide_setup(
  data,
  path,
  dv = NULL,
  var.roles = NULL,
  na = "NA",
  file.name = NULL,
  data.loc = NULL,
  verbose = FALSE
)

Value

No return value, only called for side effects; in this case, two text file are created for consumption by the GUIDE terminal application

Arguments

data

A data frame containing the training data.

path

Character string specifying the full path to where the GUIDE input files will be written to. If the given path does not exist, it will be created automatically using dir.create().

dv

Character string specifying which column represents the target/ dependent variable.

var.roles

A named character vector specifying the role of each column.

na

Character string specifying the missing value indicator.

file.name

Character string giving the file name (or prefix) to use for the generated input files. If NULL, the default, it will be parsed from the data argument.

data.loc

Character string specifying the the full path to the data input file, which is used for the first line of the generated description file. If NULL, the default, it will be determined automatically by path and file.name. This is useful if the data input file does not reside in the same directory as the GUIDE executable.

verbose

Logical indicating whether or not to print progress information.

Examples

Run this code
if (FALSE) {
# New York air quality measurements
aq <- airquality
aq <- aq[!is.na(aq$Ozone), ]  # remove rows with missing response values

# Default variable roles
guide_setup(aq, path = "some/path/aq", dv = "Ozone")

# User specified variable roles
var.roles <- c("Ozone" = "d", "Solar.R" = "n", "Wind" = "n", "Temp" = "c",
               "Month" = "p", "Day" = "p")
guide_setup(aq, path = "some/path/aq", var.roles = var.roles)
}

Run the code above in your browser using DataLab