Resolve filenames relative to the HH directory.

Share:

Description

The pathnames in the HH package for all the datasets referenced in Heiberger and Holland (2004) are given relative to the options()$HH.ROOT.DIR directory. The pathnames for all the executable files in the online files accompanying Heiberger and Holland (2004) are given relative to the
options()$HHfile.ROOT.DIR directory.

The methodology described in this help page is DEFUNCT. It was designed for standalone files from the authors' website that matched the First Edition (2004) of their book and were used prior to the construction and distribution of the HH package from CRAN.

Now the strongly recommended method is to use the HH package from CRAN for all examples from both the First Edition (2004) and the Second Edition (2015). See the Details section.

Usage

1
2
3
4
hh(file)     ## gives message about change in usage beginning with HH_2.3-17
hh.old(file) ## new name for function hh() prior to HH_2.3-17
hh.file(file)
hh.file.DOS(file, displayForCutAndPaste=TRUE)

Arguments

file

Character string giving the pathname of a file.

For hh, the file is in the HH package and the pathname is relative to
options()$HH.ROOT.DIR, the installed location of the HH package. The option is set automatically when the HH package is loaded by library or require. This function is normally used to access the datasets that come with the HH book and package.

For hh.file and hh.file.DOS, the file is in the HH online files which need to be independently downloaded from the HH book's website http://astro.temple.edu/~rmh/HH. The pathname is relative to options()$HHfile.ROOT.DIR, which must be set by the user to correspond to the location where the HH online files are stored on the specific computer. The file argument to these two functions is the relative pathname exactly as specified in the captions of figures and tables in Heiberger and Holland (2004).

displayForCutAndPaste

Logical value. When TRUE (the default) the function hh.file.DOS prints the full pathname with the "\" file separator convention so it can be picked up and pasted into an editor that uses the MS DOS convention for file paths. The function hh.file.DOS always returns a value with the full pathname using the "\\" convention so it could be used as an argument to an R or S-Plus function.

Details

Beginning with HH_2.3-17, access to datasets with the notation hh("abcde <- datasets/abcde.dat") is defunct. Instead, use the notation data(abcde). The old notation will generate an error with a message to use the new notation.

The files accessed with the notation hh("chaptername/code/normpdf.r") are defunct. Instead use the new files accessed with the notation hh.old("scripts/Chxx-chaptername.r"). The old notation will generate an error with a message to use the new notation.

The datasets from the Heiberger and Holland (2004) online files are all given paths relative to the beginning of the hh directory, which must be stored as options()$HH.ROOT.DIR. If you installed the HH datasets as part of the R or S-Plus HH package, then option options()$HH.ROOT.DIR is set automatically.

The code listings in Heiberger and Holland (2004) are all given paths relative to the beginning of the hh.file directory, which must be stored as options()$HHfile.ROOT.DIR. Most of the files are designed to be entered at the command line, and are not designed to be sourced. The primary use of the hh.file functions is to display the pathname of the file so it can be opened for use in an editor. The online files must be independently downloaded from the book's web site http://astro.temple.edu/~rmh/HH. The HHfile.ROOT.DIR option must be set by the user to correspond to the location where the files are stored. The book recommends
options(HHfile.ROOT.DIR="c:/HOME/hh") in Windows or
options(HHfile.ROOT.DIR="/usr/users/hh") in Unix. See Appendix B of Heiberger and Holland (2004) for further details. The options(HHfile.ROOT.DIR="something" statement may need to be modified to match the location of the online files directory on your machine. If you use more than one computer, you may need a different value for the HHfile.ROOT.DIR option on each machine. This is the only change you will need to make in order to run any of our software or examples. The hh, hh.file, and hh.file.DOS functions are not changed.

Value

Fully expanded, absolute pathname for the input filename. hh and hh.file use the separator convention of the file.path function. hh.file.DOS returns the pathname using the "\\" separator convention. When displayForCutAndPaste is TRUE, hh.file.DOS prints the full pathname with the "\" convention, so it can be picked up and pasted into an editor that uses the MS DOS convention for file paths.

Author(s)

Richard M. Heiberger <rmh@temple.edu>

References

Heiberger, Richard M. and Holland, Burt (2004b). Statistical Analysis and Data Display: An Intermediate Course with Examples in S-Plus, R, and SAS. Springer Texts in Statistics. Springer. ISBN 0-387-40270-5.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## hotdog <- read.table(hh.old("datasets/hotdog.dat"), header=TRUE)
## This form of data input for files from the text has been replaced by
## the alternate form
##     data(hotdog)


## Not run: 
## Define the HHfile.ROOT.DIR option first.
## Define
##   options(HHfile.ROOT.DIR="c:/HOME/hh")  ## value recommended in Appendix B
## before using the hh.file() functions.
hh.file("relativefilepath")
hh.file.DOS("relativefilepath")
hh.file.DOS("relativefilepath", displayForCutAndPaste=FALSE)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.