[R-gregmisc-users] SF.net SVN: r-gregmisc: [1133] trunk/SASxport
Brought to you by:
warnes
From: <wa...@us...> - 2007-08-09 23:29:04
|
Revision: 1133 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1133&view=rev Author: warnes Date: 2007-08-09 16:29:01 -0700 (Thu, 09 Aug 2007) Log Message: ----------- More changes, esp to lookup.xport() and friends Modified Paths: -------------- trunk/SASxport/DESCRIPTION trunk/SASxport/NAMESPACE trunk/SASxport/man/lookup.xport.Rd trunk/SASxport/man/read.xport.Rd trunk/SASxport/man/units.Rd Added Paths: ----------- trunk/SASxport/TODO Modified: trunk/SASxport/DESCRIPTION =================================================================== --- trunk/SASxport/DESCRIPTION 2007-08-09 23:28:42 UTC (rev 1132) +++ trunk/SASxport/DESCRIPTION 2007-08-09 23:29:01 UTC (rev 1133) @@ -3,11 +3,17 @@ Title: Read and write SAS export files Version: 0.99.1 Date: 2007-07-28 -Author: Gregory R. Warnes <gr...@ra...> +Author: Gregory R. Warnes <gr...@ra...>, + includes code from Frank E. Harrell, Jr.'s Hmisc package. Maintainer: Gregory R. Warnes <gr...@ra...> Description: This package provides functions to read, list contents of, and - write SAS export files. The creation of this package was funded - by Metrum Institute <http://metruminstitute.org>. + write SAS export files. This package was created by Random + Technologies LLC <http://random-technologies-llc.com> with funding + by Metrum Institute <http://metruminstitute.org>. + . + Technical support contracts and other services for for R, this + package, and other packages are available from Random Technologies + LLC <http://random-technologies-llc.com>. License: GPL 2.0 or later Imports: methods, foreign, chron Modified: trunk/SASxport/NAMESPACE =================================================================== --- trunk/SASxport/NAMESPACE 2007-08-09 23:28:42 UTC (rev 1132) +++ trunk/SASxport/NAMESPACE 2007-08-09 23:29:01 UTC (rev 1133) @@ -39,3 +39,7 @@ S3method("formats<-", default) S3method("iformat<-", default) +S3method(print, lookup.xport) +S3method(summary, lookup.xport) +S3method(print, summary.lookup.xport) + Added: trunk/SASxport/TODO =================================================================== --- trunk/SASxport/TODO (rev 0) +++ trunk/SASxport/TODO 2007-08-09 23:29:01 UTC (rev 1133) @@ -0,0 +1,17 @@ +- Write replacements for SAS's REVERSE function, which corrects for + differences in endianness, and cnxptieee function, which is used to + convert from the IBM floating point representation to the IEEE + representation. + +- Write test routines for very large files, particulary very large + files with columns contiaining almost all missing values. + +- Test that created files are properly read by SAS, particulary when + the SAS version and OS version are set to the default values I've + provided. + +- Check function for 64 bit versions of R. I suspect that there may + be variable size issues for some int fields for write.xport(). + +- + Modified: trunk/SASxport/man/lookup.xport.Rd =================================================================== --- trunk/SASxport/man/lookup.xport.Rd 2007-08-09 23:28:42 UTC (rev 1132) +++ trunk/SASxport/man/lookup.xport.Rd 2007-08-09 23:29:01 UTC (rev 1133) @@ -1,33 +1,75 @@ \name{lookup.xport} \alias{lookup.xport} +\alias{print.lookup.xport} +\alias{summary.lookup.xport} +\alias{print.summary.lookup.xport} \title{Lookup Information on a SAS XPORT Format Library} \description{ - Scans a file as a SAS XPORT format library and returns a list - containing information about the SAS library. + Describe the contents of an SAS XPORT format file. } \usage{ lookup.xport(file) +\method{print}{lookup.xport}(x, ...) +\method{summary}{lookup.xport}(x, ...) +\method{print}{summary.lookup.xport}(x, ...) } \arguments{ - \item{file}{character variable with the name of the file to read. The - file must be in SAS XPORT format.} + \item{file}{Character string specifying the name or URL of a SAS XPORT file.} + \item{x}{Object to be printed or summarized} + \item{...}{Optional arguments} } \value{ - A list with one component for each dataset in the XPORT format library. + \code{lookup.xport} returs a list with one component for each dataset + in the XPORT format library. + + \code{summary.lookup.xport} returns a + single data frame containing the following component + \item{dataset}{ Dataset name,} + \item{name}{ Variable name,} + \item{type}{ Type of variable (one of 'character' or 'numeric'),} + \item{format}{ SAS format, } + \item{width}{ SAS format width, } + \item{label}{ Variable label, } + \item{nobs}{ Number of observations. } + } -\references{ - SAS Technical Support document TS-140: - \dQuote{The Record Layout of a Data Set in SAS Transport (XPORT) Format} - available as - \url{http://ftp.sas.com/techsup/download/technote/ts140.html}. +\details{ + The \code{lookup.xport} function is a simple wrapper for the + \code{\link[foreign]{lookup.xport}} function provided by the + \code{foreign} library. The wrapped adds the ability to handle URL's, + and returns an object of class \code{lookup.xport} for which + appropriate \code{print}, and \code{summary} functions are provide. } -\author{Saikat DebRoy} \seealso{ - \code{\link{read.xport}} + For complete documentation of \code{lookup.xport} see the manual page + for \code{\link[foreign]{lookup.xport}}. } \examples{ \dontrun{ -lookup.xport("transport") +## Get information on a local file +lookup.xport("xxx.xpt") } + +## Or read a copy of test2.xpt available on the web: +url <- 'http://biostat.mc.vanderbilt.edu/cgi-bin/viewvc.cgi/*checkout*/Hmisc/trunk/tests/test2.xpt' +w <- lookup.xport(url) + +# display the infromation (calls 'print.lookup.xport') +w + +# names of data sets +names(w) + +# names of variables within data sets +w$Z$name + +# use summary +wS <- summary(w) +wS # same display + +# variable names within all data sets +wS$name + } \keyword{file} +\keyword{manip} \ No newline at end of file Modified: trunk/SASxport/man/read.xport.Rd =================================================================== --- trunk/SASxport/man/read.xport.Rd 2007-08-09 23:28:42 UTC (rev 1132) +++ trunk/SASxport/man/read.xport.Rd 2007-08-09 23:29:01 UTC (rev 1133) @@ -17,8 +17,8 @@ ) } \arguments{ - \item{file}{name of a file containing the SAS transport file. May be a - URL beginning with \code{http://}. + \item{file}{Character string specifying the name or URL of a SAS XPORT + file. } \item{force.integer}{Logical flag indicating whether integer-valued variables should be returned as integers (\code{TRUE}) or doubles Modified: trunk/SASxport/man/units.Rd =================================================================== --- trunk/SASxport/man/units.Rd 2007-08-09 23:28:42 UTC (rev 1132) +++ trunk/SASxport/man/units.Rd 2007-08-09 23:29:01 UTC (rev 1133) @@ -1,20 +1,28 @@ \name{units} + \alias{units} - \alias{units.default} - \alias{units<-} +\alias{units<-.default} \alias{label} +\alias{label.default} \alias{label<-} +\alias{label<-.default} \alias{formats} +\alias{formats.default} \alias{formats<-} +\alias{formats<-.default} \alias{iformat} +\alias{iformat.default} \alias{iformat<-} +\alias{iformat<-.default} + + \title{ -Set or Retreive the Label, Format, iFormat, or Units Attribute of a Vector +Set or Retreive the label, format, iformat, or units Attribute of a Vector } \description{ Sets or retrieves the \code{"label"}, \code{"format"}, @@ -24,41 +32,68 @@ available in Frank Harrell's \code{Hmisc} package. } \usage{ -units(x, ...) -\method{units}{default}(x, none='', \dots) +units(x, default) units(x) <- value + +label(x, default) +label(x) <- value + +formats(x, default) +formats(x) <- value + +iformat(x, default) +iformat(x) <- value + } \arguments{ \item{x}{any object} -\item{\dots}{ignored} -\item{value}{the units of the object, or ""} -\item{none}{value to which to set result if no appropriate attribute is - found} +\item{value}{new value for the \code{"label"}, \code{"format"}, + \code{"iformat"}, or \code{"units"} attribute of an object.} +\item{default}{value to return when no appropriate attribute is + found. The usual return value is NULL.} } \value{ -the units attribute of x, if any; otherwise, the \code{units} attribute of -the \code{tspar} attribute of \code{x} if any; otherwise the value \code{none} + the contents of the \code{"label"}, \code{"format"}, \code{"iformat"}, or + \code{"units"} attribute of x, if any; otherwise, the value provided by + \code{default}. } \author{Gregory R. Warnes \email{gr...@ra...} based on code from the \code{Hmisc} library by Frank E. Harrell, Jr.} \seealso{\code{\link{label}}} \examples{ + fail.time <- c(10,20) -units(fail.time) <- "Day" + +# set attributes +units(fail.time) <- 'Day' label(fail.time) <- 'Failure Time' -fail.time +formats(fail.time) <- 'Numeric2' +iformat(fail.time) <- 'Numeric2' + +# display individual attributes +units(fail.time) +label(fail.time) +formats(fail.time) +iformat(fail.time) + +# display all attributes +attributes(fail.time) + +# Example showing specification of default return value +a <- 70 +label(a, default="no label") + + \dontrun{ - # for a nice display library(Hmisc) describe(fail.time) - - f <- cph(Surv(fail.time, event) ~ xx) plot(xx,xx2,xlab=paste(label(xx),", ",units(xx),"s",sep="")) } + } \keyword{utilities} \keyword{interface} -% Converted by Sd2Rd version 1.21. + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |