From noreply at r-forge.r-project.org Tue May 23 17:55:38 2017 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 23 May 2017 17:55:38 +0200 (CEST) Subject: [R-gregmisc-commits] r2145 - / branches/GenerateFORMATSfromFactorObjects/SASxport/R pkg pkg/SASxport pkg/SASxport/R pkg/SASxport/inst pkg/SASxport/man pkg/SASxport/src pkg/SASxport/tests pkg/gtools/R tags/gtools_2.3.0/R Message-ID: <20170523155538.334FC188921@r-forge.r-project.org> Author: warnes Date: 2017-05-23 17:55:37 +0200 (Tue, 23 May 2017) New Revision: 2145 Added: pkg/SASxport/.Rbuildignore pkg/SASxport/.gitignore pkg/SASxport/.travis.yml pkg/SASxport/NEWS.md pkg/SASxport/R/package.R pkg/SASxport/README.md pkg/SASxport/appveyor.yml pkg/SASxport/inst/NEWS.md Removed: pkg/SASxport/.Rproj.user/ pkg/SASxport/R/AFirst.lib.s pkg/SASxport/R/all.is.numeric.R pkg/SASxport/R/blanks.R pkg/SASxport/R/importConvertDateTime.R pkg/SASxport/R/in.opererator.R pkg/SASxport/R/makeNames.R pkg/SASxport/R/testDateTime.R Modified: / branches/GenerateFORMATSfromFactorObjects/SASxport/R/fromSASDate.R pkg/ pkg/SASxport/ pkg/SASxport/DESCRIPTION pkg/SASxport/NAMESPACE pkg/SASxport/R/SASformat.R pkg/SASxport/R/SASiformat.R pkg/SASxport/R/SAStype.R pkg/SASxport/R/fromSASDate.R pkg/SASxport/R/fstr.R pkg/SASxport/R/lookup.xport.R pkg/SASxport/R/makeSASNames.R pkg/SASxport/R/parseFormat.R pkg/SASxport/R/process.formats.R pkg/SASxport/R/read.xport.R pkg/SASxport/R/scat.R pkg/SASxport/R/toSAS.R pkg/SASxport/R/write.xport.R pkg/SASxport/R/xport.NA.R pkg/SASxport/R/xport.R pkg/SASxport/R/xport.dateFMT.R pkg/SASxport/R/xport.file.header.R pkg/SASxport/R/xport.fill.R pkg/SASxport/R/xport.member.header.R pkg/SASxport/R/xport.namestr.R pkg/SASxport/R/zzz.R pkg/SASxport/inst/ChangeLog pkg/SASxport/man/SASformat.Rd pkg/SASxport/man/read.xport.Rd pkg/SASxport/man/write.xport.Rd pkg/SASxport/src/SASxport.c pkg/SASxport/src/SASxport.h pkg/SASxport/src/to_bigend.h pkg/SASxport/tests/Alfalfa_Test.R pkg/SASxport/tests/Alfalfa_Test.Rout.save pkg/SASxport/tests/Theoph.Rout.save pkg/SASxport/tests/cars.Rout.save pkg/SASxport/tests/datetime.xpt pkg/SASxport/tests/dfAttributes.R pkg/SASxport/tests/testDates.Rout.save pkg/SASxport/tests/testDuplicateNames.Rout.save pkg/SASxport/tests/testEmpty.Rout.save pkg/SASxport/tests/testExamples.R pkg/SASxport/tests/testExamples.Rout.save pkg/SASxport/tests/testManyNames.Rout.save pkg/SASxport/tests/testNegative.Rout.save pkg/SASxport/tests/testNumeric.Rout.save pkg/SASxport/tests/test_as_is.Rout.save pkg/SASxport/tests/test_fields.Rout.save pkg/SASxport/tests/xport.R pkg/SASxport/tests/xport.Rout.save pkg/SASxport/tests/xxx.R pkg/SASxport/tests/xxx.Rout.save pkg/gtools/R/ask.R pkg/gtools/R/quantcut.R pkg/gtools/R/smartbind.R tags/gtools_2.3.0/R/scat.R Log: - Integrate changes made by Mango Solutions at https://github.com/MangoTheCat/SASxport. - Remove functions duplicated from the Hmisc package. - Minor code cleanup. Property changes on: ___________________________________________________________________ Added: svn:ignore + *.Rproj* .Rproj.user Modified: branches/GenerateFORMATSfromFactorObjects/SASxport/R/fromSASDate.R =================================================================== --- branches/GenerateFORMATSfromFactorObjects/SASxport/R/fromSASDate.R 2016-08-24 19:48:14 UTC (rev 2144) +++ branches/GenerateFORMATSfromFactorObjects/SASxport/R/fromSASDate.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,3 +1,4 @@ +# Convert SAS date to R date fromSASDate <- function( sDate ) { sasBase <- as.Date(strptime("01/01/1960 0:00:00", "%m/%d/%Y %H:%M:%S", tz="GMT")) # days @@ -4,7 +5,7 @@ sasBase + sDate } - +# Convert SAS datetime to R date fromSASDateTime <- function( sDateTime ) { sasBaseSeconds <- as.numeric(ISOdatetime(1960,1,1,0,0,0) - 0) Property changes on: pkg ___________________________________________________________________ Modified: svn:ignore - *.Rcheck *.tar.gz + *.Rcheck *.tar.gz .Rproj.user Property changes on: pkg/SASxport ___________________________________________________________________ Added: svn:ignore + *.Rproj* Added: pkg/SASxport/.Rbuildignore =================================================================== --- pkg/SASxport/.Rbuildignore (rev 0) +++ pkg/SASxport/.Rbuildignore 2017-05-23 15:55:37 UTC (rev 2145) @@ -0,0 +1,4 @@ +^.travis.yml$ +^appveyor.yml$ +^README.md$ +^NEWS.md$ Added: pkg/SASxport/.gitignore =================================================================== --- pkg/SASxport/.gitignore (rev 0) +++ pkg/SASxport/.gitignore 2017-05-23 15:55:37 UTC (rev 2145) @@ -0,0 +1,2 @@ +/src/*.o +/src/SASxport.so Added: pkg/SASxport/.travis.yml =================================================================== --- pkg/SASxport/.travis.yml (rev 0) +++ pkg/SASxport/.travis.yml 2017-05-23 15:55:37 UTC (rev 2145) @@ -0,0 +1,34 @@ +## Sample .travis.yml file for use with metacran/r-builder +## See https://github.com/metacran/r-builder for details. + +language: c +sudo: required + +before_install: + - curl -OL https://raw.githubusercontent.com/metacran/r-builder/master/pkg-build.sh + - chmod 755 pkg-build.sh + - ./pkg-build.sh bootstrap + +install: + - ./pkg-build.sh install_deps + - ./pkg-build.sh install_r covr + +script: + - ./pkg-build.sh run_tests + +after_failure: + - ./pkg-build.sh dump_logs + +after_success: + - if [[ ! -z "$COVERAGE" ]];then ./pkg-build.sh run_script -e 'covr::codecov()'; fi + +notifications: + email: + on_success: change + on_failure: change + +env: + matrix: + - RVERSION=oldrel + - RVERSION=release + - RVERSION=devel COVERAGE=true Modified: pkg/SASxport/DESCRIPTION =================================================================== --- pkg/SASxport/DESCRIPTION 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/DESCRIPTION 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,42 +1,73 @@ Package: SASxport -Type: Package -Title: Read and Write SAS XPORT Files +Title: Read and Write 'SAS' 'XPORT' Files Version: 1.5.4 -Date: 2016-03-25 +Date: 2017-05-22 Description: Functions for reading, listing - the contents of, and writing SAS xport format files. - The functions support reading and writing of either - individual data frames or sets of data frames. Further, - a mechanism has been provided for customizing how - variables of different data types are stored. -Author: - Unless otherwise noted, the contents of this package were written by - Gregory R. Warnes and are provided under the - terms of the GNU General Public License, version 2.0 or later. - -- - The files 'src/ieee2ibm.c' and 'src/ibm2ieee.c' were extracted from - BRL-CAD file /brlcad/src/libbu/htond.c written by Michael John - Muuss, Copyright (c) 2004-2007 United States Government as - represented by the U.S. Army Research Laboratory, and is utilized - and redistributed under the terms of the GNU Lesser General Public - License, version 2.1. - -- - The files 'R/AFirst.lib.s', 'R/all.is.numeric.R', - 'R/importConvertDateTime.R', 'R/in.opererator.R', 'R/makeNames.R', - 'R/read.xport.R', and 'R/testDateTime.R' are copied or adapted from the - 'Hmisc' package created by Frank E. Harrell, Jr. - , and are utilized and redistributed under - the terms of the GNU General Public License, version 2.0 or later. - -- - The files 'R/xport.R', 'src/SASxport.c', 'src/SASxport.h', and - 'src/foreign.h' are copied or adapted from the R 'foreign' package - created by Douglas M. Bates and Saikat DebRoy - , and are utilized and redistributed under the - terms of the GNU General Public License, version 2.0 or later. - -- - The creation of this package was partially funded by Metrum Institute - . + the contents of, and writing 'SAS' 'xport' format files. + The functions support reading and writing of either + individual data frames or sets of data frames. Further, + a mechanism has been provided for customizing how + variables of different data types are stored. +Author: Unless otherwise noted, the contents of this package were written by + Gregory R. Warnes and are provided under the + terms of the GNU General Public License, version 2.0 or later. + -- + The files 'src/ieee2ibm.c' and 'src/ibm2ieee.c' were extracted from + BRL-CAD file /brlcad/src/libbu/htond.c written by Michael John + Muuss, Copyright (c) 2004-2007 United States Government as + represented by the U.S. Army Research Laboratory, and is utilized + and redistributed under the terms of the GNU Lesser General Public + License, version 2.1. + -- + The file 'R/read.xport.R' is adapted from the 'Hmisc' package created + by Frank E. Harrell, Jr. , and is utilized + and redistributed under the terms of the GNU General Public License, + version 2.0 or later. + -- + The files 'R/xport.R', 'src/SASxport.c', 'src/SASxport.h', and + 'src/foreign.h' are copied or adapted from the 'R' 'foreign' package + created by Douglas M. Bates and Saikat DebRoy + , and are utilized and redistributed under the + terms of the GNU General Public License, version 2.0 or later. + -- + The creation of this package was partially funded by Metrum Institute + . Maintainer: Gregory R. Warnes License: GPL-2 -Depends: R (>= 2.4.0), chron, Hmisc -URL: http://www.warnes.net, http://metruminstitute.org +Depends: + R (>= 2.4.0) +Imports: + Hmisc, + utils +URL: https://github.com/mangothecat/SASxport +BugReports: https://github.com/mangothecat/SASxport/issues +RoxygenNote: 5.0.1 +Collate: + 'SASformat.R' + 'SASiformat.R' + 'SAStype.R' + 'fromSASDate.R' + 'fstr.R' + 'lookup.xport.R' + 'make.formats.R' + 'makeSASNames.R' + 'package.R' + 'parseFormat.R' + 'process.formats.R' + 'rawToDisplay.R' + 'read.xport.R' + 'scat.R' + 'toSAS.R' + 'write.xport.R' + 'xport.NA.R' + 'xport.R' + 'xport.character.R' + 'xport.dateFMT.R' + 'xport.file.header.R' + 'xport.fill.R' + 'xport.member.header.R' + 'xport.namestr.R' + 'xport.namestr.header.R' + 'xport.numeric.R' + 'xport.obs.header.R' + 'zzz.R' Modified: pkg/SASxport/NAMESPACE =================================================================== --- pkg/SASxport/NAMESPACE 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/NAMESPACE 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,60 +1,40 @@ -useDynLib(SASxport, .registration=TRUE) +# Generated by roxygen2: do not edit by hand -importFrom(chron, chron, times) -importFrom(utils, packageDescription) -importFrom(Hmisc, label, label.default, "label<-", "label<-.default") -importFrom(utils, download.file) - -export( - toSAS, - lookup.xport, - read.xport, - write.xport, - ## "label", - ## "label<-", - - makeSASNames, - - "SASformat", - "SASformat<-", - - "SASiformat", - "SASiformat<-", - - "SAStype", - "SAStype<-" -) - -S3method(toSAS, numeric) -S3method(toSAS, logical) -S3method(toSAS, character) -S3method(toSAS, factor) -S3method(toSAS, chron) -S3method(toSAS, POSIXt) -S3method(toSAS, Date) -S3method(toSAS, default) - -## S3method(label, default) -S3method(SASformat, default) -S3method(SASiformat, default) -S3method(SAStype, default) - -## S3method(label, data.frame) -S3method(SASformat, data.frame) -S3method(SASiformat, data.frame) -##S3method(SAStype, data.frame) - -## S3method("label<-", default) -S3method("SASformat<-", default) -S3method("SASiformat<-", default) -S3method("SAStype<-", default) - -## S3method("label<-", data.frame) -S3method("SASformat<-", data.frame) -S3method("SASiformat<-", data.frame) -##S3method("SAStype<-", data.frame) - -S3method(print, lookup.xport) -S3method(summary, lookup.xport) -S3method(print, summary.lookup.xport) - +S3method("SASformat<-",data.frame) +S3method("SASformat<-",default) +S3method("SASiformat<-",data.frame) +S3method("SASiformat<-",default) +S3method("SAStype<-",default) +S3method(SASformat,data.frame) +S3method(SASformat,default) +S3method(SASiformat,data.frame) +S3method(SASiformat,default) +S3method(SAStype,default) +S3method(print,lookup.xport) +S3method(print,summary.lookup.xport) +S3method(summary,lookup.xport) +S3method(toSAS,Date) +S3method(toSAS,POSIXt) +S3method(toSAS,character) +S3method(toSAS,chron) +S3method(toSAS,default) +S3method(toSAS,factor) +S3method(toSAS,logical) +S3method(toSAS,numeric) +export("SASformat<-") +export("SASiformat<-") +export("SAStype<-") +export(SASformat) +export(SASiformat) +export(SAStype) +export(lookup.xport) +export(makeSASNames) +export(read.xport) +export(toSAS) +export(write.xport) +importFrom(Hmisc,"label<-") +importFrom(Hmisc,"label<-.data.frame") +importFrom(Hmisc,"label<-.default") +importFrom(Hmisc,label) +importFrom(utils,download.file) +useDynLib(SASxport) Added: pkg/SASxport/NEWS.md =================================================================== --- pkg/SASxport/NEWS.md (rev 0) +++ pkg/SASxport/NEWS.md 2017-05-23 15:55:37 UTC (rev 2145) @@ -0,0 +1 @@ +link inst/NEWS.md \ No newline at end of file Property changes on: pkg/SASxport/NEWS.md ___________________________________________________________________ Added: svn:special + * Deleted: pkg/SASxport/R/AFirst.lib.s =================================================================== --- pkg/SASxport/R/AFirst.lib.s 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/AFirst.lib.s 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,25 +0,0 @@ -## -## Code originally from Frank Harrell's 'Hmisc' library: -## http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/Hmisc -## Copied with permission on 2007-08-04 -## - -## $Id: AFirst.lib.s,v 1.6 2005/09/26 15:44:17 dupontct Exp $ -under.unix <- !(version$os=='Microsoft Windows' || - version$os=='Win32' || version$os=='mingw32') - -# .R. <- TRUE -# .SV4. <- FALSE - -.noGenenerics <- TRUE # faster loading as new methods not used - -if(!exists('existsFunction')) { - existsFunction <- function(...) exists(..., mode='function') -} - -# if(.R.) { - ## create some function definitions just to avoid R CMD CHECK warnings - timeDate <- function(...) stop("Not Implemented") -# dates <- function(...) stop("Not Implemented") -# } - Modified: pkg/SASxport/R/SASformat.R =================================================================== --- pkg/SASxport/R/SASformat.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/SASformat.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,6 +1,9 @@ +#' @export SASformat <- function(x, default) UseMethod("SASformat") + +#' @export SASformat.default <- function(x, default=NULL) { lab <- attr(x,"SASformat") @@ -10,14 +13,20 @@ lab } + +#' @export SASformat.data.frame <- function(x, default=NULL) { sapply( x, SASformat) } + +#' @export "SASformat<-" <- function(x, value) UseMethod("SASformat<-") + +#' @export "SASformat<-.default" <- function(x, value) { attr(x,'SASformat') <- value @@ -25,6 +34,7 @@ } +#' @export "SASformat<-.data.frame" <- function(x, value) { if( ncol(x) != length(value) ) Modified: pkg/SASxport/R/SASiformat.R =================================================================== --- pkg/SASxport/R/SASiformat.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/SASiformat.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,6 +1,9 @@ +#' @export SASiformat <- function(x, default) UseMethod("SASiformat") + +#' @export SASiformat.default <- function(x, default=NULL) { lab <- attr(x,"SASiformat") @@ -11,22 +14,26 @@ } +#' @export SASiformat.data.frame <- function(x, default=NULL) { sapply( x, SASiformat) } - +#' @export "SASiformat<-" <- function(x, value) UseMethod("SASiformat<-") +#' @export "SASiformat<-.default" <- function(x, value) { attr(x,'SASiformat') <- value x } + +#' @export "SASiformat<-.data.frame" <- function(x, value) { if( ncol(x) != length(value) ) Modified: pkg/SASxport/R/SAStype.R =================================================================== --- pkg/SASxport/R/SAStype.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/SAStype.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,6 +1,9 @@ +#' @export SAStype <- function(x, default) UseMethod("SAStype") + +#' @export SAStype.default <- function(x, default=NULL) { lab <- attr(x,"SAStype") @@ -10,9 +13,13 @@ lab } + +#' @export "SAStype<-" <- function(x, value) UseMethod("SAStype<-") + +#' @export "SAStype<-.default" <- function(x, value) { attr(x,'SAStype') <- makeSASNames(value) Deleted: pkg/SASxport/R/all.is.numeric.R =================================================================== --- pkg/SASxport/R/all.is.numeric.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/all.is.numeric.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,22 +0,0 @@ -## -## Code originally from Frank Harrell's 'Hmisc' library: -## http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/Hmisc -## Copied with permission on 2007-08-04 -## - -all.is.numeric <- function(x, what=c('test','vector'), extras=c('.','NA')) -{ - what <- match.arg(what) - old <- options(warn=-1) - on.exit(options(old)) - ##.Options$warn <- -1 6Aug00 - x <- sub('[[:space:]]+$', '', x) - x <- sub('^[[:space:]]+', '', x) - xs <- x[x %nin% c('',extras)] - isnum <- !any(is.na(as.numeric(xs))) - if(what=='test') - isnum - else if(isnum) - as.numeric(x) - else x -} Deleted: pkg/SASxport/R/blanks.R =================================================================== --- pkg/SASxport/R/blanks.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/blanks.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,5 +0,0 @@ -blanks <- -function(nchar) - { - sprintf( paste("%",nchar,".",nchar,"s",sep=""), "" ) - } Modified: pkg/SASxport/R/fromSASDate.R =================================================================== --- pkg/SASxport/R/fromSASDate.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/fromSASDate.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,3 +1,4 @@ +# Convert SAS date values to R 'Date' objects fromSASDate <- function( sDate ) { sasBase <- as.Date(strptime("01/01/1960 0:00:00", "%m/%d/%Y %H:%M:%S", tz="GMT")) # days @@ -5,6 +6,7 @@ } +# Convert SAS DateTime values to R 'POSIXct' objects fromSASDateTime <- function( sDateTime ) { sasBaseSeconds <- as.numeric(ISOdatetime(1960,1,1,0,0,0) - 0) Modified: pkg/SASxport/R/fstr.R =================================================================== --- pkg/SASxport/R/fstr.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/fstr.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,6 +1,7 @@ +# Construct a SAS format string for a specified (vector of) type names, lengths, and digits. fstr <- function(name, length, digits) { - invalid <- function(x) is.null(x) | ( length(x)<1 ) | ( nchar(x, "bytes") < 1 ) | x==0 + invalid <- function(x) is.null(x) | ( length(x)<1 ) | ( nchar(x) < 1 ) | x==0 inner <- function(i) { if( invalid(name[i]) ) Deleted: pkg/SASxport/R/importConvertDateTime.R =================================================================== --- pkg/SASxport/R/importConvertDateTime.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/importConvertDateTime.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,21 +0,0 @@ -## -## Code originally from Frank Harrell's 'Hmisc' library: -## http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/Hmisc -## Copied with permission on 2007-08-04 -## - -importConvertDateTime <- - function(x, type=c('date','time','datetime'), input='sas', form) -{ - type <- match.arg(type) - input <- match.arg(input) - - adjdays <- 3653 ## 1970-1-1 minus 1960-1-1 - - switch(type, - date = structure(x - adjdays, class='Date'), - time = times(x/86400, out.format=c(dates='day mon year', times='h:m:s')), - datetime = chron((x - adjdays*86400)/86400, - out.format=c(dates='day mon year', times='h:m:s')) - ) -} Deleted: pkg/SASxport/R/in.opererator.R =================================================================== --- pkg/SASxport/R/in.opererator.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/in.opererator.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,7 +0,0 @@ -## -## Code originally from Frank Harrell's 'Hmisc' library: -## http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/Hmisc -## Copied with permission on 2007-08-04 -## - -"%nin%" <- function(a, b) ! (a %in% b) Modified: pkg/SASxport/R/lookup.xport.R =================================================================== --- pkg/SASxport/R/lookup.xport.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/lookup.xport.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,4 +1,7 @@ ## Simply make this accessible here as a convenience to the user + +#' @export +#' @importFrom utils download.file lookup.xport <- function(file) { fname <- file @@ -18,6 +21,8 @@ ret } + +#' @export print.lookup.xport <- function(x, ...) { Sinfo <- summary(x, ...) @@ -25,6 +30,7 @@ } +#' @export summary.lookup.xport <- function(object, ...) { subFun <- function(XX) @@ -52,6 +58,7 @@ singleFrame } +#' @export print.summary.lookup.xport <- function(x, ...) { cat("\n") Deleted: pkg/SASxport/R/makeNames.R =================================================================== --- pkg/SASxport/R/makeNames.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/makeNames.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,18 +0,0 @@ -## -## Code originally from Frank Harrell's 'Hmisc' library: -## http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/Hmisc -## Copied with permission on 2007-08-04 -## - -makeNames <- function(names, unique=FALSE, allow=NULL) -{ - # ## Runs make.names with exceptions in vector allow - # ## By default, R 1.9 make.names is overridden to convert _ to . as - # ## with S-Plus and previous versions of R. Specify allow='_' otherwise. - # if(!.R. & length(allow)) - # stop('does not apply for S-Plus') - n <- make.names(names, unique) - if(!length(allow)) - n <- gsub('_', '.', n) - n -} Modified: pkg/SASxport/R/makeSASNames.R =================================================================== --- pkg/SASxport/R/makeSASNames.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/makeSASNames.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,3 +1,4 @@ +#' @export makeSASNames <- function(names, nchar=8, maxPasses=10, quiet=FALSE) { ## This function takes a vector of potential SAS dataset or @@ -6,9 +7,9 @@ # Step 0: converce to uppercase names <- toupper(names) - + # Step 1: expand/truncate to 8 characters - tooLong <- nchar(names, "bytes")>8 + tooLong <- nchar(names)>8 if (any(tooLong)) { shortNames <- substr(as.character(names), 1, nchar) @@ -28,18 +29,18 @@ passes <- passes+1 dups <- duplicated(varNames) repeatCount <- table(varNames)-1 - digitChars <- nchar(as.character(repeatCount), "bytes")+1 + digitChars <- nchar(as.character(repeatCount))+1 names(digitChars) <- names(repeatCount) newNames <- make.names(substr(varNames, 1, nchar-digitChars[varNames]), unique=TRUE) changed <- newNames != names - + ##newNames[changed] <- gsub("\\.([0-9]+)$","\\1", newNames[changed]) varNames <- newNames } if(any(duplicated(varNames))) stop("Unable to make all names unique after ", passes, " passes.") - + if(any(dups) && !quiet) warning("Made ",sum(dups)," duplicate names unique.") Added: pkg/SASxport/R/package.R =================================================================== --- pkg/SASxport/R/package.R (rev 0) +++ pkg/SASxport/R/package.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -0,0 +1,3 @@ + +#' @useDynLib SASxport +NULL Modified: pkg/SASxport/R/parseFormat.R =================================================================== --- pkg/SASxport/R/parseFormat.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/parseFormat.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -17,7 +17,7 @@ { retval$name <- substr(format,0,index-1)[1] - lenStr <- substr(format, index, nchar(format, "bytes")) + lenStr <- substr(format, index, nchar(format)) index <- regexpr("\\.", lenStr) if(index==-1) @@ -28,7 +28,7 @@ else { retval$len <- as.numeric(substr(lenStr, 0, index-1)) - retval$digits <- as.numeric(substr(lenStr, index+1, nchar(lenStr, "bytes"))) + retval$digits <- as.numeric(substr(lenStr, index+1, nchar(lenStr))) } } Modified: pkg/SASxport/R/process.formats.R =================================================================== --- pkg/SASxport/R/process.formats.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/process.formats.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -31,7 +31,7 @@ if(!all(st==en)) stop("Format ranges are not handled.") - list(value = all.is.numeric(st, 'vector'), + list(value = Hmisc::all.is.numeric(st, 'vector'), label = lab) }) finfo Modified: pkg/SASxport/R/read.xport.R =================================================================== --- pkg/SASxport/R/read.xport.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/read.xport.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -4,6 +4,10 @@ ## Copied with permission on 2007-08-04 ## +#' @importFrom Hmisc label label<- label<-.default label<-.data.frame +#' @importFrom utils download.file +#' @export + read.xport <- function(file, force.integer=TRUE, formats=NULL, @@ -40,8 +44,8 @@ scat("Checking if the specified file has the appropriate header") xport.file.header <- "HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!000000000000000000000000000000 " - file.header <- readBin( file, what=character(0), n=1, size=nchar(xport.file.header, "bytes") ) - file.header <- substr(file.header, start=1, stop=nchar(xport.file.header, "bytes") ) + file.header <- readBin( file, what=character(0), n=1, size=nchar(xport.file.header) ) + file.header <- substr(file.header, start=1, stop=nchar(xport.file.header) ) if( !identical(xport.file.header, file.header) ) stop("The specified file does not start with a SAS xport file header!") @@ -126,7 +130,7 @@ SAStype(w) <- dsTypes[k] names(SAStype(w)) <- NULL - nam <- names.tolower(makeNames(names(w), allow=name.chars)) + nam <- names.tolower(Hmisc::makeNames(names(w), allow=name.chars)) names(w) <- nam dinfo <- dsinfo[[k]] @@ -138,7 +142,7 @@ lab <- dinfo$label - ndinfo <- names.tolower(makeNames(dinfo$name, allow=name.chars)) + ndinfo <- names.tolower(Hmisc::makeNames(dinfo$name, allow=name.chars)) names(lab) <- names(fmt) <- names(formats) <- names(iformats) <- ndinfo if(length(w)>0) for(i in 1:length(w)) { @@ -157,13 +161,13 @@ if(is.numeric(x)) { if(fi %in% sasdateform) { - x <- importConvertDateTime(x, 'date', 'sas') + x <- Hmisc::importConvertDateTime(x, 'date', 'sas') changed <- TRUE } else if(fi %in% sastimeform) { - x <- importConvertDateTime(x, 'time', 'sas') + x <- Hmisc::importConvertDateTime(x, 'time', 'sas') changed <- TRUE } else if(fi %in% sasdatetimeform) { - x <- importConvertDateTime(x, 'datetime', 'sas') + x <- Hmisc::importConvertDateTime(x, 'datetime', 'sas') changed <- TRUE } else if(force.integer) { if(all(is.na(x))) { Modified: pkg/SASxport/R/scat.R =================================================================== --- pkg/SASxport/R/scat.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/scat.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,6 +1,4 @@ -# $Id: scat.R 625 2005-06-09 14:20:30Z nj7w $ - -# cat to stdout and immediately flush +# Write message to stdout and immediately flush scat <- function(...) { DEBUG <- options()$DEBUG Deleted: pkg/SASxport/R/testDateTime.R =================================================================== --- pkg/SASxport/R/testDateTime.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/testDateTime.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,45 +0,0 @@ -## -## Code originally from Frank Harrell's 'Hmisc' library: -## http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/Hmisc -## Copied with permission on 2007-08-04 -## - -## Determine if variable is a date, time, or date/time variable in R -## or S-Plus. The following 2 functions are used by describe.vector -## timeUsed assumes is date/time combination variable and has no NAs -testDateTime <- function(x, what=c('either','both','timeVaries')) -{ - what <- match.arg(what) - cl <- class(x) # was oldClass 22jun03 - if(!length(cl)) - return(FALSE) - - # dc <- if(.R.) - # c('Date', 'POSIXt','POSIXct','dates','times','chron') - # else - # c('timeDate','date','dates','times','chron') - dc <- c('Date', 'POSIXt','POSIXct','dates','times','chron') - - # dtc <- if(.R.) - # c('POSIXt','POSIXct','chron') - # else - # c('timeDate','chron') - dtc <- c('POSIXt','POSIXct','chron') - - switch(what, - either = any(cl %in% dc), - both = any(cl %in% dtc), - timeVaries = { - #if('chron' %in% cl || 'Date' %in% cl || !.R.) { - if('chron' %in% cl || 'Date' %in% cl) { - ## chron or S+ timeDate - y <- as.numeric(x) - length(unique(round(y - floor(y),13))) > 1 - } - # else if(.R.) - else - length(unique(format(x,'%H%M%S'))) > 1 - # else - # FALSE - }) -} Modified: pkg/SASxport/R/toSAS.R =================================================================== --- pkg/SASxport/R/toSAS.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/toSAS.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,6 +1,9 @@ +#' @export toSAS <- function(x, format, format.info=NULL) UseMethod("toSAS") + +#' @export toSAS.numeric <- function(x, format=SASformat(x), format.info=NULL) { retval <- as.numeric(x) @@ -8,14 +11,17 @@ retval } + +#' @export toSAS.logical <- function(x, format=SASformat(x), format.info=NULL) { retval <- as.character(x) attr(retval, "SASformat")=format retval } + - +#' @export toSAS.character <- function(x, format=SASformat(x), format.info=NULL) { retval <- as.character(x) @@ -23,6 +29,8 @@ retval } + +#' @export toSAS.factor <- function(x, format=SASformat(x), format.info=NULL) { finfo <- process.formats(format.info) @@ -40,6 +48,8 @@ retval } + +#' @export toSAS.POSIXt <- function( x, format="DATETIME16.", format.info=NULL) { sasBaseSeconds <- as.numeric(ISOdatetime(1960,1,1,0,0,0)) @@ -48,6 +58,8 @@ retval } + +#' @export toSAS.Date <- function(x, format="DATE9.", format.info=NULL ) { sasBase <- as.Date(strptime("01/01/1960", "%m/%d/%Y", tz="GMT")) # days @@ -56,11 +68,15 @@ retval } + +#' @export toSAS.default <- function(x, format=SASformat(x), format.info=NULL) { retval <- as.character(x) attr(retval, "SASformat") <- format retval } - + + +#' @export toSAS.chron <- toSAS.POSIXt Modified: pkg/SASxport/R/write.xport.R =================================================================== --- pkg/SASxport/R/write.xport.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/write.xport.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,3 +1,5 @@ +#' @importFrom Hmisc label +#' @export write.xport <- function(..., list=base::list(), file = stop("'file' must be specified"), @@ -187,10 +189,19 @@ df[[i]] <- var <- toSAS(var, format.info=formats) # compute variable length - if(is.character(var)) - varLen <- max(c(8,nchar(var, "bytes") ) ) - else + # From R 3.3.0 NA is returned by nchar if the + # the argument is NA, unless keepNA = FALSE is supplied + # In older versions nchar(NA) is 2, and this is the + # behavior we need now + if(is.character(var)) { + if ("keepNA" %in% names(as.list(args(nchar)))) { + varLen <- max(c(8,nchar(var, keepNA = FALSE) ) ) + } else { + varLen <- max(c(8,nchar(var) ) ) + } + } else { varLen <- 8 + } # fill in variable offset and length information offsetTable[i, "len"] <- varLen Modified: pkg/SASxport/R/xport.NA.R =================================================================== --- pkg/SASxport/R/xport.NA.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/xport.NA.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,4 +1,3 @@ - xport.NA <- function() { .C("fill_numeric_NA", PACKAGE="SASxport") Modified: pkg/SASxport/R/xport.R =================================================================== --- pkg/SASxport/R/xport.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/xport.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -21,11 +21,13 @@ ### License along with this program; if not, a copy is available at ### http://www.r-project.org/Licenses/ -lookup.xport.inner <- function(file) .Call(xport_info, file) +lookup.xport.inner <- function(file) { + .Call('xport_info', file, PACKAGE = "SASxport") +} read.xport.inner <- function(file, stringsAsFactors=FALSE) { data.info <- lookup.xport.inner(file) - ans <- .Call(xport_read, file, data.info) + ans <- .Call('xport_read', file, data.info, PACKAGE = "SASxport") if (length(ans) == 1L) as.data.frame(ans[[1L]], stringsAsFactors=stringsAsFactors) else Modified: pkg/SASxport/R/xport.dateFMT.R =================================================================== --- pkg/SASxport/R/xport.dateFMT.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/xport.dateFMT.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,5 +1,4 @@ -`xport.dateFMT` <- - function(when, fill=16) +xport.dateFMT <- function(when, fill=16) { if(missing(when)) when <- Sys.time() Modified: pkg/SASxport/R/xport.file.header.R =================================================================== --- pkg/SASxport/R/xport.file.header.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/xport.file.header.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,5 +1,4 @@ -`xport.file.header` <- - function( cDate=Sys.time(), mDate=cDate, sasVer="7.00", osType="Unknown" ) +xport.file.header <- function( cDate=Sys.time(), mDate=cDate, sasVer="7.00", osType="Unknown" ) { .C("fill_file_header", cDate = xport.dateFMT(cDate), # Creation date @@ -10,6 +9,5 @@ ) .Call("getRawBuffer", PACKAGE="SASxport") - } Modified: pkg/SASxport/R/xport.fill.R =================================================================== --- pkg/SASxport/R/xport.fill.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/xport.fill.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,7 +1,5 @@ xport.fill <- function( useSpace, width ) { - - .C("fill_space", value = as.integer(useSpace), width = as.integer(width), Modified: pkg/SASxport/R/xport.member.header.R =================================================================== --- pkg/SASxport/R/xport.member.header.R 2016-08-24 19:48:14 UTC (rev 2144) +++ pkg/SASxport/R/xport.member.header.R 2017-05-23 15:55:37 UTC (rev 2145) @@ -1,6 +1,10 @@ -`xport.member.header` <- -function(dfName, cDate=Sys.time(), mDate=cDate, sasVer="7.00", osType="Unknown", - dfLabel="", dfType="" ) +xport.member.header <- function(dfName, + cDate=Sys.time(), + mDate=cDate, [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/r-gregmisc -r 2145 From noreply at r-forge.r-project.org Wed May 24 23:40:14 2017 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 24 May 2017 23:40:14 +0200 (CEST) Subject: [R-gregmisc-commits] r2146 - pkg/SASxport Message-ID: <20170524214014.5637C188BB3@r-forge.r-project.org> Author: warnes Date: 2017-05-24 23:40:13 +0200 (Wed, 24 May 2017) New Revision: 2146 Modified: pkg/SASxport/.Rbuildignore Log: Add a couple of files to the list ignored by R. Modified: pkg/SASxport/.Rbuildignore =================================================================== --- pkg/SASxport/.Rbuildignore 2017-05-23 15:55:37 UTC (rev 2145) +++ pkg/SASxport/.Rbuildignore 2017-05-24 21:40:13 UTC (rev 2146) @@ -2,3 +2,6 @@ ^appveyor.yml$ ^README.md$ ^NEWS.md$ +^.gitignore +.Rproj$ + From noreply at r-forge.r-project.org Thu May 25 00:09:13 2017 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 25 May 2017 00:09:13 +0200 (CEST) Subject: [R-gregmisc-commits] r2147 - pkg/SASxport/tests Message-ID: <20170524220913.0A23A181324@r-forge.r-project.org> Author: warnes Date: 2017-05-25 00:09:12 +0200 (Thu, 25 May 2017) New Revision: 2147 Removed: pkg/SASxport/tests/testFactorAllNA.R Modified: pkg/SASxport/tests/Alfalfa_Test.Rout.save pkg/SASxport/tests/Theoph.Rout.save pkg/SASxport/tests/cars.Rout.save pkg/SASxport/tests/testDates.Rout.save pkg/SASxport/tests/testDuplicateNames.Rout.save pkg/SASxport/tests/testEmpty.Rout.save pkg/SASxport/tests/testExamples.R pkg/SASxport/tests/testExamples.Rout.save pkg/SASxport/tests/testManyNames.Rout.save pkg/SASxport/tests/testNegative.Rout.save pkg/SASxport/tests/testNumeric.Rout.save pkg/SASxport/tests/testUnnamedComponents.Rout.save pkg/SASxport/tests/test_as_is.Rout.save pkg/SASxport/tests/test_fields.Rout.save pkg/SASxport/tests/xport.Rout.save pkg/SASxport/tests/xxx.Rout.save Log: Update stored test output. Modified: pkg/SASxport/tests/Alfalfa_Test.Rout.save =================================================================== --- pkg/SASxport/tests/Alfalfa_Test.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/Alfalfa_Test.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" +Copyright (C) 2016 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -19,13 +19,12 @@ > ## existing SAS xport file "Alfalfa.xpt" > > library(SASxport) -Loading required package: chron -Loading required package: Hmisc -Loading required package: grid -Loading required package: lattice -Loading required package: survival -Loading required package: splines -Loading required package: Formula + +Loaded SASxport version 1.5.4 (2017-05-22). + + Type `?SASxport' for usage information. + + > Sys.setenv("TZ"="GMT") > > # existing data file @@ -849,4 +848,4 @@ > > proc.time() user system elapsed - 0.518 0.053 0.561 + 1.454 0.097 1.557 Modified: pkg/SASxport/tests/Theoph.Rout.save =================================================================== --- pkg/SASxport/tests/Theoph.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/Theoph.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" +Copyright (C) 2016 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -21,13 +21,12 @@ > #### > > library(SASxport) -Loading required package: chron -Loading required package: Hmisc -Loading required package: grid -Loading required package: lattice -Loading required package: survival -Loading required package: splines -Loading required package: Formula + +Loaded SASxport version 1.5.4 (2017-05-22). + + Type `?SASxport' for usage information. + + > Sys.setenv("TZ"="GMT") > > write.xport(Theoph,file="theoph.xpt") @@ -45,4 +44,4 @@ > > proc.time() user system elapsed - 0.584 0.038 0.610 + 1.522 0.077 1.606 Modified: pkg/SASxport/tests/cars.Rout.save =================================================================== --- pkg/SASxport/tests/cars.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/cars.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" +Copyright (C) 2016 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -16,13 +16,12 @@ Type 'q()' to quit R. > library(SASxport) -Loading required package: chron -Loading required package: Hmisc -Loading required package: grid -Loading required package: lattice -Loading required package: survival -Loading required package: splines -Loading required package: Formula + +Loaded SASxport version 1.5.4 (2017-05-22). + + Type `?SASxport' for usage information. + + > Sys.setenv("TZ"="GMT") > > @@ -513,4 +512,4 @@ > > proc.time() user system elapsed - 0.483 0.048 0.533 + 1.400 0.086 1.492 Modified: pkg/SASxport/tests/testDates.Rout.save =================================================================== --- pkg/SASxport/tests/testDates.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/testDates.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" +Copyright (C) 2016 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -16,13 +16,12 @@ Type 'q()' to quit R. > library(SASxport) -Loading required package: chron -Loading required package: Hmisc -Loading required package: grid -Loading required package: lattice -Loading required package: survival -Loading required package: splines -Loading required package: Formula + +Loaded SASxport version 1.5.4 (2017-05-22). + + Type `?SASxport' for usage information. + + > Sys.setenv("TZ"="GMT") > > ## Create a small data set containing dates, times, and date-times @@ -64,4 +63,4 @@ > > proc.time() user system elapsed - 0.472 0.034 0.496 + 1.458 0.079 1.543 Modified: pkg/SASxport/tests/testDuplicateNames.Rout.save =================================================================== --- pkg/SASxport/tests/testDuplicateNames.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/testDuplicateNames.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" +Copyright (C) 2016 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -16,13 +16,12 @@ Type 'q()' to quit R. > library(SASxport) -Loading required package: chron -Loading required package: Hmisc -Loading required package: grid -Loading required package: lattice -Loading required package: survival -Loading required package: splines -Loading required package: Formula + +Loaded SASxport version 1.5.4 (2017-05-22). + + Type `?SASxport' for usage information. + + > Sys.setenv("TZ"="GMT") > > ## Read example dataset from a local file @@ -35,24 +34,24 @@ In makeSASNames(dfNames) : Made 3 duplicate names unique. > read.xport("dn.a.xpt") $AA - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 $AA.1 - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 $AA.2 - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 $AA.3 - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 > > # Duplicate column names @@ -63,13 +62,13 @@ Warning message: In makeSASNames(colnames(df)) : Made 5 duplicate names unique. > read.xport("dn.b.xpt") - RACE AGE D1 DT1 T1 RACE.1 AGE.1 D1.1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 blue 30 2002-03-03 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 31 2002-06-03 - DT1.1 T1.1 -1 (03 Mar 2002 09:31:02) 11:13:45 -2 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 RACE.1 AGE.1 D1.1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 blue 30 2002-03-03 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 31 2002-06-03 + DT1.1 T1.1 +1 2002-03-03 09:31:02 11:13:45 +2 2002-06-03 09:42:07 11:14:13 > > proc.time() user system elapsed - 0.493 0.036 0.518 + 1.479 0.083 1.577 Modified: pkg/SASxport/tests/testEmpty.Rout.save =================================================================== --- pkg/SASxport/tests/testEmpty.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/testEmpty.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" +Copyright (C) 2016 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -16,13 +16,12 @@ Type 'q()' to quit R. > library(SASxport) -Loading required package: chron -Loading required package: Hmisc -Loading required package: grid -Loading required package: lattice -Loading required package: survival -Loading required package: splines -Loading required package: Formula + +Loaded SASxport version 1.5.4 (2017-05-22). + + Type `?SASxport' for usage information. + + > > data(iris) > write.xport(Iris1=iris[1:2,], @@ -72,4 +71,4 @@ > > proc.time() user system elapsed - 0.515 0.038 0.541 + 1.453 0.078 1.538 Modified: pkg/SASxport/tests/testExamples.R =================================================================== --- pkg/SASxport/tests/testExamples.R 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/testExamples.R 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,5 +1,4 @@ library(SASxport) -library(Hmisc) Sys.setenv("TZ"="GMT") set.seed(42) Modified: pkg/SASxport/tests/testExamples.Rout.save =================================================================== --- pkg/SASxport/tests/testExamples.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/testExamples.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,5 +1,5 @@ -R version 3.2.4 (2016-03-10) -- "Very Secure Dishes" +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin13.4.0 (64-bit) @@ -16,17 +16,11 @@ Type 'q()' to quit R. > library(SASxport) -> library(Hmisc) -Loading required package: lattice -Loading required package: survival -Loading required package: Formula -Loading required package: ggplot2 -Attaching package: 'Hmisc' +Loaded SASxport version 1.5.4 (2017-05-22). -The following objects are masked from 'package:base': + Type `?SASxport' for usage information. - format.pval, round.POSIXt, trunc.POSIXt, units > Sys.setenv("TZ"="GMT") > @@ -178,4 +172,4 @@ > > proc.time() user system elapsed - 0.626 0.040 0.656 + 1.428 0.078 1.519 Deleted: pkg/SASxport/tests/testFactorAllNA.R =================================================================== --- pkg/SASxport/tests/testFactorAllNA.R 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/testFactorAllNA.R 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,17 +0,0 @@ -library(SASxport) -Sys.setenv("TZ"="GMT") - -x <- data.frame(A=1:10, - B=letters[1:10], - C=factor(rep(NA,10)), - D=factor(rep(NA,10), levels=c("A","B","C")), - E=as.numeric(rep(NA,10)), - stringsAsFactors=FALSE - ) -write.xport(x,file='testFactorAllNA.out.xpt') - -y <- read.xport(file='testFactorAllNA.out.xpt') - -stopifnot( all.equal(x,y, check.attributes = FALSE) ) -stopifnot( all.equal(levels(x$C), levels(y$C) ) ) -stopifnot( all.equal(levels(x$D), levels(y$D) ) ) Modified: pkg/SASxport/tests/testManyNames.Rout.save =================================================================== --- pkg/SASxport/tests/testManyNames.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/testManyNames.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" +Copyright (C) 2016 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -16,13 +16,12 @@ Type 'q()' to quit R. > library(SASxport) -Loading required package: chron -Loading required package: Hmisc -Loading required package: grid -Loading required package: lattice -Loading required package: survival -Loading required package: splines -Loading required package: Formula + +Loaded SASxport version 1.5.4 (2017-05-22). + + Type `?SASxport' for usage information. + + > Sys.setenv("TZ"="GMT") > > data(iris) @@ -97,4 +96,4 @@ > > proc.time() user system elapsed - 4.290 0.056 4.341 + 4.495 0.116 4.636 Modified: pkg/SASxport/tests/testNegative.Rout.save =================================================================== --- pkg/SASxport/tests/testNegative.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/testNegative.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" +Copyright (C) 2016 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -16,13 +16,12 @@ Type 'q()' to quit R. > library(SASxport) -Loading required package: chron -Loading required package: Hmisc -Loading required package: grid -Loading required package: lattice -Loading required package: survival -Loading required package: splines -Loading required package: Formula + +Loaded SASxport version 1.5.4 (2017-05-22). + + Type `?SASxport' for usage information. + + > Sys.setenv("TZ"="GMT") > > df1 <- data.frame( f=c(1.0, -1.0), d=as.integer(c(-1,1) ) ) @@ -50,4 +49,4 @@ > > proc.time() user system elapsed - 0.513 0.036 0.538 + 1.547 0.086 1.652 Modified: pkg/SASxport/tests/testNumeric.Rout.save =================================================================== --- pkg/SASxport/tests/testNumeric.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/testNumeric.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" +Copyright (C) 2016 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -16,13 +16,12 @@ Type 'q()' to quit R. > library(SASxport) -Loading required package: chron -Loading required package: Hmisc -Loading required package: grid -Loading required package: lattice -Loading required package: survival -Loading required package: splines -Loading required package: Formula + +Loaded SASxport version 1.5.4 (2017-05-22). + + Type `?SASxport' for usage information. + + > Sys.setenv("TZ"="GMT") > > ## @@ -89,4 +88,4 @@ > > proc.time() user system elapsed - 0.560 0.034 0.584 + 1.520 0.080 1.609 Modified: pkg/SASxport/tests/testUnnamedComponents.Rout.save =================================================================== --- pkg/SASxport/tests/testUnnamedComponents.Rout.save 2017-05-24 21:40:13 UTC (rev 2146) +++ pkg/SASxport/tests/testUnnamedComponents.Rout.save 2017-05-24 22:09:12 UTC (rev 2147) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" +Copyright (C) 2016 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -16,25 +16,12 @@ Type 'q()' to quit R. > library(SASxport) -Loading required package: chron -Loading required package: Hmisc -Loading required package: grid -Loading required package: lattice -Loading required package: survival -Loading required package: splines -Loading required package: Formula -Attaching package: 'Hmisc' +Loaded SASxport version 1.5.4 (2017-05-22). -The following objects are masked from 'package:base': - - format.pval, round.POSIXt, trunc.POSIXt, units - - -Loaded SASxport version 1.5.0 (2014-07-21). - Type `?SASxport' for usage information. + > Sys.setenv("TZ"="GMT") > > ##tests @@ -90,9 +77,9 @@ rd.xpr> sapply(w, head) $TEST - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 $Z X3 X4 X5 X6 X7 X8 @@ -118,9 +105,9 @@ rd.xpr> sapply(w, head) $TEST - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 $Z X3 X4 X5 X6 X7 X8 @@ -140,9 +127,9 @@ rd.xpr> sapply(w, head) $TEST - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 $Z X3 X4 X5 X6 X7 X8 @@ -167,300 +154,24 @@ rd.xpr> ## Don't show: rd.xpr> stopifnot( is.data.frame(w)==FALSE && is.list(w)==TRUE ) -rd.xpr> ## End Don't show +rd.xpr> ## End(Don't show) rd.xpr> -rd.xpr> rd.xpr> #### The Hmisc library provides many useful functions for interacting with rd.xpr> #### data imported from SAS via read.xport() -rd.xpr> library(Hmisc) - -rd.xpr> describe(w$TEST) # see labels, format names for dataset test -w$TEST - - 5 Variables 2 Observations --------------------------------------------------------------------------------- -RACE - n missing unique value - 1 1 1 blue --------------------------------------------------------------------------------- -AGE : Age at Beginning of Study - n missing unique Info Mean - 2 0 2 1 30.5 - -30 (1, 50%), 31 (1, 50%) --------------------------------------------------------------------------------- -D1 - n missing unique - 2 0 2 - -2002-03-03 (1, 50%), 2002-06-03 (1, 50%) --------------------------------------------------------------------------------- -DT1 Format:day mon year h:m:s - n missing unique - 2 0 2 - Info Mean - 1 (18 Apr 2002 09:36:35) - -(03 Jun 2002 09:42:07) (1, 50%) -(03 Mar 2002 09:31:02) (1, 50%) --------------------------------------------------------------------------------- -T1 Format:h:m:s - n missing unique Info Mean - 2 0 2 1 :01: - -11:13:45 (1, 50%), 11:14:13 (1, 50%) --------------------------------------------------------------------------------- - -rd.xpr> lapply(w, describe)# see descriptive stats in more detail for each variable -$TEST -X[[1]] - - 5 Variables 2 Observations --------------------------------------------------------------------------------- -RACE - n missing unique value - 1 1 1 blue --------------------------------------------------------------------------------- -AGE : Age at Beginning of Study - n missing unique Info Mean - 2 0 2 1 30.5 - -30 (1, 50%), 31 (1, 50%) --------------------------------------------------------------------------------- -D1 - n missing unique - 2 0 2 - -2002-03-03 (1, 50%), 2002-06-03 (1, 50%) --------------------------------------------------------------------------------- -DT1 Format:day mon year h:m:s - n missing unique - 2 0 2 - Info Mean - 1 (18 Apr 2002 09:36:35) - -(03 Jun 2002 09:42:07) (1, 50%) -(03 Mar 2002 09:31:02) (1, 50%) --------------------------------------------------------------------------------- -T1 Format:h:m:s - n missing unique Info Mean - 2 0 2 1 :01: - -11:13:45 (1, 50%), 11:14:13 (1, 50%) --------------------------------------------------------------------------------- - -$Z -X[[2]] - - 6 Variables 100 Observations --------------------------------------------------------------------------------- -X3 - n missing unique Info Mean .05 .10 .25 .50 .75 - 100 0 100 1 0.5131 0.05585 0.13304 0.26428 0.51257 0.80719 - .90 .95 -0.93059 0.96426 - -lowest : 0.00576 0.01524 0.02380 0.02627 0.05351 -highest: 0.96948 0.97473 0.98010 0.98096 0.99390 --------------------------------------------------------------------------------- -X4 - n missing unique Info Mean .05 .10 .25 .50 .75 - 100 0 100 1 0.5119 0.06694 0.09393 0.22310 0.49638 0.82109 - .90 .95 -0.92206 0.94963 - -lowest : 0.02636 0.02890 0.02926 0.03010 0.05395 -highest: 0.95790 0.96828 0.97047 0.97466 0.98267 --------------------------------------------------------------------------------- -X5 - n missing unique Info Mean .05 .10 .25 .50 .75 - 100 0 100 1 0.4888 0.04286 0.06765 0.19898 0.46766 0.77899 - .90 .95 -0.89237 0.91886 - -lowest : 0.004134 0.007872 0.008811 0.038577 0.039260 -highest: 0.933789 0.975597 0.984074 0.996114 0.997253 --------------------------------------------------------------------------------- -X6 - n missing unique Info Mean .05 .10 .25 .50 .75 - 100 0 100 1 0.4987 0.09022 0.18649 0.26865 0.46423 0.72667 - .90 .95 -0.85553 0.93149 - -lowest : 0.01010 0.01943 0.03064 0.05931 0.08775 -highest: 0.93330 0.96090 0.97310 0.97840 0.99511 --------------------------------------------------------------------------------- -X7 - n missing unique Info Mean .05 .10 .25 .50 .75 - 100 0 100 1 0.5533 0.0850 0.1474 0.3313 0.5666 0.8120 - .90 .95 - 0.9176 0.9517 - -lowest : 0.04201 0.04716 0.04986 0.05864 0.07641 -highest: 0.96377 0.97244 0.97413 0.99318 0.99791 --------------------------------------------------------------------------------- -X8 - n missing unique Info Mean .05 .10 .25 .50 .75 - 100 0 100 1 0.4809 0.04251 0.06831 0.27122 0.49223 0.71333 - .90 .95 -0.87322 0.91886 - -lowest : 0.007269 0.010586 0.013044 0.018595 0.039906 -highest: 0.930491 0.935669 0.936941 0.958679 0.959636 --------------------------------------------------------------------------------- - -$FORMATS -X[[3]] - - 21 Variables 3 Observations --------------------------------------------------------------------------------- -FMTNAME - n missing unique value - 3 0 1 RACE --------------------------------------------------------------------------------- -START - n missing unique - 3 0 3 - - 1 (1, 33%), 2 (1, 33%) - 3 (1, 33%) --------------------------------------------------------------------------------- -END - n missing unique - 3 0 3 - - 1 (1, 33%), 2 (1, 33%) - 3 (1, 33%) --------------------------------------------------------------------------------- -LABEL - n missing unique - 3 0 3 - -blue (1, 33%), green (1, 33%), purple (1, 33%) --------------------------------------------------------------------------------- -MIN - n missing unique Info Mean - 3 0 1 0 1 --------------------------------------------------------------------------------- -MAX - n missing unique Info Mean - 3 0 1 0 40 --------------------------------------------------------------------------------- -DEFAULT - n missing unique Info Mean - 3 0 1 0 6 --------------------------------------------------------------------------------- -LENGTH - n missing unique Info Mean - 3 0 1 0 6 --------------------------------------------------------------------------------- -FUZZ - n missing unique Info Mean - 3 0 1 0 1e-12 --------------------------------------------------------------------------------- -MULT - n missing unique Info Mean - 3 0 1 0 0 --------------------------------------------------------------------------------- -NOEDIT - n missing unique Info Mean - 3 0 1 0 0 --------------------------------------------------------------------------------- -TYPE - n missing unique value - 3 0 1 N --------------------------------------------------------------------------------- -SEXCL - n missing unique value - 3 0 1 N --------------------------------------------------------------------------------- -EEXCL - n missing unique value - 3 0 1 N --------------------------------------------------------------------------------- - -Variables with all observations missing: - -[1] PREFIX FILL HLO DECSEP DIG3SEP DATATYPE LANGUAGE - - -rd.xpr> contents(w$TEST) # another way to see variable attributes - -Data frame:w$TEST 2 observations and 5 variables Maximum # NAs:1 - - Labels Levels Class Storage NAs -RACE 3 integer 1 -AGE Age at Beginning of Study integer integer 0 -D1 Date double 0 -DT1 chron double 0 -T1 times double 0 - -+--------+-----------------+ -|Variable|Levels | -+--------+-----------------+ -| RACE |green,blue,purple| -+--------+-----------------+ - -rd.xpr> lapply(w, contents)# show contents of individual items in more detail -$TEST - -Data frame:X[[1L]] 2 observations and 5 variables Maximum # NAs:1 - - Labels Levels Class Storage NAs -RACE 3 integer 1 -AGE Age at Beginning of Study integer integer 0 -D1 Date double 0 -DT1 chron double 0 -T1 times double 0 - -+--------+-----------------+ -|Variable|Levels | -+--------+-----------------+ -| RACE |green,blue,purple| -+--------+-----------------+ - -$Z - -Data frame:X[[2L]] 100 observations and 6 variables Maximum # NAs:0 - - Storage -X3 double -X4 double -X5 double -X6 double -X7 double -X8 double - -$FORMATS - -Data frame:X[[3L]] 3 observations and 21 variables Maximum # NAs:0 - - Storage -FMTNAME character -START character -END character -LABEL character -MIN double -MAX double -DEFAULT double -LENGTH double -FUZZ double -PREFIX character -MULT double -FILL character -NOEDIT double -TYPE character -SEXCL character -EEXCL character -HLO character -DECSEP character -DIG3SEP character -DATATYPE character -LANGUAGE character - - -rd.xpr> options(digits=7) # compare the following matrix with PROC MEANS output - +rd.xpr> +rd.xpr> ## Not run: +rd.xpr> ##D ## For Hmisc version 3.14-5 (and presumably prior to that one) you will need to +rd.xpr> ##D ## attach Hmisc. This is because describe and contents S3 methods' are not exported +rd.xpr> ##D ## Newer version of Hmisc fix the issue +rd.xpr> ##D +rd.xpr> ##D Hmisc::describe(w$TEST) # see labels, format names for dataset test +rd.xpr> ##D lapply(w, Hmisc::describe)# see descriptive stats in more detail for each variable +rd.xpr> ##D +rd.xpr> ##D Hmisc::contents(w$TEST) # another way to see variable attributes +rd.xpr> ##D lapply(w, Hmisc::contents)# show contents of individual items in more detail +rd.xpr> ## End(Not run) +rd.xpr> +rd.xpr> ## compare the following matrix with PROC MEANS output rd.xpr> t(sapply(w$Z, function(x) rd.xpr+ c(Mean=mean(x),SD=sqrt(var(x)),Min=min(x),Max=max(x)))) Mean SD Min Max @@ -487,7 +198,7 @@ W$TEST AGE character 0 0 0 0 W$TEST D1 numeric MMDDYY 10 0 0 0 W$TEST DT1 numeric DATETIME 0 0 0 0 - W$TEST T1 character TIME 0 0 0 0 + W$TEST T1 numeric TIME 0 0 0 0 label nobs 2 Age at Beginning of Study 2 @@ -496,9 +207,9 @@ 2 > (tmp <- read.xport("a.xpt")) #1.c - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 > > b <- w$test > write.xport(b,file="a.xpt") #2.a @@ -514,7 +225,7 @@ B AGE character 0 0 0 0 B D1 numeric MMDDYY 10 0 0 0 B DT1 numeric DATETIME 0 0 0 0 - B T1 character TIME 0 0 0 0 + B T1 numeric TIME 0 0 0 0 label nobs 2 Age at Beginning of Study 2 @@ -523,9 +234,9 @@ 2 > (tmp <- read.xport("a.xpt")) #2.c - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 > > write.xport(test=w$test,file="a.xpt") #3.a > lookup.xport("a.xpt") #3.b @@ -540,7 +251,7 @@ TEST AGE character 0 0 0 0 TEST D1 numeric MMDDYY 10 0 0 0 TEST DT1 numeric DATETIME 0 0 0 0 - TEST T1 character TIME 0 0 0 0 + TEST T1 numeric TIME 0 0 0 0 label nobs 2 Age at Beginning of Study 2 @@ -549,9 +260,9 @@ 2 > (tmp <- read.xport("a.xpt")) #3.c - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 2002-03-03 09:31:02 11:13:45 +2 31 2002-06-03 2002-06-03 09:42:07 11:14:13 [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/r-gregmisc -r 2147